aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/primitives/symmetric-encryption.rst9
1 files changed, 6 insertions, 3 deletions
diff --git a/docs/primitives/symmetric-encryption.rst b/docs/primitives/symmetric-encryption.rst
index 4f404789..a8d9485d 100644
--- a/docs/primitives/symmetric-encryption.rst
+++ b/docs/primitives/symmetric-encryption.rst
@@ -15,14 +15,17 @@ where the encrypter and decrypter both use the same key.
Block ciphers work by encrypting content in chunks, often 64- or 128-bits.
They combine an underlying algorithm (such as AES), with a mode (such as
- CBC, CTR, or GCM). A simple example of encrypting content with AES is:
+ CBC, CTR, or GCM). A simple example of encrypting (and then decrypting)
+ content with AES is:
.. doctest::
>>> from cryptography.primitives.block import BlockCipher, ciphers, modes
>>> cipher = BlockCipher(ciphers.AES(key), modes.CBC(iv))
- >>> context = cipher.encryptor()
- >>> context.update(b"a secret message") + context.finalize()
+ >>> encrypt = cipher.encryptor()
+ >>> ct = encrypt.update(b"a secret message") + encrypt.finalize()
+ >>> decrypt = cipher.decryptor()
+ >>> decrypt.update(ct) + decrypt.finalize()
'...'
:param cipher: One of the ciphers described below.