From 653463f0e133def71425a26fdd80bfe7c8ad5961 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 21 Oct 2013 17:55:01 -0500 Subject: address review comments * inline some methods * refactor enc/dec classes * modify docs --- docs/primitives/symmetric-encryption.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'docs/primitives') 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. -- cgit v1.2.3