diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-10-21 17:55:01 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-10-21 18:00:05 -0500 |
commit | 653463f0e133def71425a26fdd80bfe7c8ad5961 (patch) | |
tree | 1572961e89a9b1502ad91464b891b85ca611b426 /docs | |
parent | e98867acf056857d6e9b005fd00c07de2c31570f (diff) | |
download | cryptography-653463f0e133def71425a26fdd80bfe7c8ad5961.tar.gz cryptography-653463f0e133def71425a26fdd80bfe7c8ad5961.tar.bz2 cryptography-653463f0e133def71425a26fdd80bfe7c8ad5961.zip |
address review comments
* inline some methods
* refactor enc/dec classes
* modify docs
Diffstat (limited to 'docs')
-rw-r--r-- | docs/primitives/symmetric-encryption.rst | 9 |
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. |