aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-08-12 07:40:59 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2013-08-12 07:40:59 -0400
commit6959a168b19e626bfb301e7d8fb82a7a08df9d30 (patch)
treef77b806f0e1bfa74b3c44cfd71ba83a43221e941
parent4502e7b5eceb861eee9b4871e3adfe6db3bde6ec (diff)
parent173de98d630b77583d4541e399b164cc2eb014a7 (diff)
downloadcryptography-6959a168b19e626bfb301e7d8fb82a7a08df9d30.tar.gz
cryptography-6959a168b19e626bfb301e7d8fb82a7a08df9d30.tar.bz2
cryptography-6959a168b19e626bfb301e7d8fb82a7a08df9d30.zip
Merge branch 'simple-symmetric-encryption' of https://github.com/alex/cryptography into simple-symmetric-encryption
-rw-r--r--docs/primitives/symmetric-encryption.rst12
1 files changed, 9 insertions, 3 deletions
diff --git a/docs/primitives/symmetric-encryption.rst b/docs/primitives/symmetric-encryption.rst
index 9986d89d..1b8d1d73 100644
--- a/docs/primitives/symmetric-encryption.rst
+++ b/docs/primitives/symmetric-encryption.rst
@@ -1,6 +1,13 @@
Symmetric Encryption
====================
+.. testsetup::
+
+ import binascii
+ key = binascii.unhexlify(b"0" * 32)
+ iv = binascii.unhexlify(b"0" * 32)
+
+
Symmetric encryption is a way to encrypt (hide the plaintext value) material
where the encrypter and decrypter both use the same key.
@@ -10,13 +17,12 @@ where the encrypter and decrypter both use the same key.
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:
- .. code-block:: pycon
+ .. doctest::
>>> from cryptography.primitives.block import BlockCipher, ciphers, modes
>>> cipher = BlockCipher(ciphers.AES(key), modes.CBC(iv))
>>> cipher.encrypt(b"a secret message") + cipher.finalize()
- # The ciphertext
- [...]
+ '...'
:param cipher: One of the ciphers described below.
:param mode: One of the modes described below.