diff options
author | Hynek Schlawack <hs@ox.cx> | 2013-09-07 12:14:31 -0700 |
---|---|---|
committer | Hynek Schlawack <hs@ox.cx> | 2013-09-07 12:14:31 -0700 |
commit | 5e00e96f20f8c70614b463015e64a277a4348576 (patch) | |
tree | 416db58071e8bc6ad51f613e7c01edb9cfb6ae64 /docs/primitives | |
parent | a53f81dbb49a8504559e9d8ef7e2dd386c15ed41 (diff) | |
parent | aaa22171618e18888d0a0487d4564bcdae5c2015 (diff) | |
download | cryptography-5e00e96f20f8c70614b463015e64a277a4348576.tar.gz cryptography-5e00e96f20f8c70614b463015e64a277a4348576.tar.bz2 cryptography-5e00e96f20f8c70614b463015e64a277a4348576.zip |
Merge pull request #28 from alex/simple-symmetric-encryption
[WIP] initial implementation of symmetric encryption
Diffstat (limited to 'docs/primitives')
-rw-r--r-- | docs/primitives/symmetric-encryption.rst | 12 |
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. |