aboutsummaryrefslogtreecommitdiffstats
path: root/docs/fernet.rst
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-11-22 10:18:30 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-11-22 10:18:30 -0800
commit7a121fce784efb6d436816d84ed01e873f251490 (patch)
tree6a726039267f660d1d617b0646862930e182aa2d /docs/fernet.rst
parent56bcade581e68ad0dd82dbabe97c75a9f0701fed (diff)
downloadcryptography-7a121fce784efb6d436816d84ed01e873f251490.tar.gz
cryptography-7a121fce784efb6d436816d84ed01e873f251490.tar.bz2
cryptography-7a121fce784efb6d436816d84ed01e873f251490.zip
More info in the docs
Diffstat (limited to 'docs/fernet.rst')
-rw-r--r--docs/fernet.rst18
1 files changed, 14 insertions, 4 deletions
diff --git a/docs/fernet.rst b/docs/fernet.rst
index e4756c09..c95077bb 100644
--- a/docs/fernet.rst
+++ b/docs/fernet.rst
@@ -28,16 +28,16 @@ using it cannot be manipulated or read without the key.
>>> f.decrypt(ciphertext)
'my deep dark secret'
- :param bytes key: A base64 encoded 32-byte key. This **must** be kept
- secret. Anyone with this key is able to create and read
- messages.
+ :param bytes key: A URL-safe base64-encoded 32-byte key. This **must** be
+ kept secret. Anyone with this key is able to create and
+ read messages.
.. method:: encrypt(plaintext)
:param bytes plaintext: The message you would like to encrypt.
:returns bytes: A secure message which cannot be read or altered
- without the key. It is URL safe base64-encoded.
+ without the key. It is URL-safe base64-encoded.
.. method:: decrypt(ciphertext, ttl=None)
@@ -49,6 +49,16 @@ using it cannot be manipulated or read without the key.
provided (or is ``None``), the age of the message is
not considered.
:returns bytes: The original plaintext.
+ :raises InvalidToken: If the ``ciphertext`` is in any way invalid, this
+ exception is raised. A ciphertext may be invalid
+ for a number of reasons: it is older than the
+ ``ttl``, it is malformed, or it does not have a
+ valid signature.
+
+
+.. class:: InvalidToken
+
+ See :meth:`Fernet.decrypt` for more information.
.. _`Fernet`: https://github.com/fernet/spec/