aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives/symmetric-encryption.rst
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-11-06 15:53:40 +0800
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-11-06 15:53:40 +0800
commit051099ee7ea64b902fc9821f139d0a955bfe8bc4 (patch)
treee2ac9d1ee23b26ce3be63bc183550057c6034538 /docs/hazmat/primitives/symmetric-encryption.rst
parent4ec3f253a81a42e2804831c40f4ac28be4b56577 (diff)
downloadcryptography-051099ee7ea64b902fc9821f139d0a955bfe8bc4.tar.gz
cryptography-051099ee7ea64b902fc9821f139d0a955bfe8bc4.tar.bz2
cryptography-051099ee7ea64b902fc9821f139d0a955bfe8bc4.zip
update docs
Diffstat (limited to 'docs/hazmat/primitives/symmetric-encryption.rst')
-rw-r--r--docs/hazmat/primitives/symmetric-encryption.rst27
1 files changed, 13 insertions, 14 deletions
diff --git a/docs/hazmat/primitives/symmetric-encryption.rst b/docs/hazmat/primitives/symmetric-encryption.rst
index c1c8d247..7d3b072d 100644
--- a/docs/hazmat/primitives/symmetric-encryption.rst
+++ b/docs/hazmat/primitives/symmetric-encryption.rst
@@ -4,7 +4,7 @@
Symmetric Encryption
====================
-.. currentmodule:: cryptography.hazmat.primitives.block
+.. currentmodule:: cryptography.hazmat.primitives.ciphers
.. testsetup::
@@ -16,24 +16,23 @@ Symmetric Encryption
Symmetric encryption is a way to encrypt (hide the plaintext value) material
where the encrypter and decrypter both use the same key.
-.. class:: BlockCipher(cipher, mode)
+.. class:: Cipher(algorithm, mode)
- 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
+ Cipher objects combine an algorithm (such as AES) with a mode (such as
CBC, CTR, or GCM). A simple example of encrypting (and then decrypting)
content with AES is:
.. doctest::
- >>> from cryptography.hazmat.primitives.block import BlockCipher, ciphers, modes
- >>> cipher = BlockCipher(ciphers.AES(key), modes.CBC(iv))
+ >>> from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
+ >>> cipher = Cipher(algorithms.AES(key), modes.CBC(iv))
>>> encryptor = cipher.encryptor()
>>> ct = encryptor.update(b"a secret message") + encryptor.finalize()
>>> decryptor = cipher.decryptor()
>>> decryptor.update(ct) + decryptor.finalize()
'a secret message'
- :param cipher: One of the ciphers described below.
+ :param algorithms: One of the algorithms described below.
:param mode: One of the modes described below.
.. method:: encryptor()
@@ -61,7 +60,7 @@ where the encrypter and decrypter both use the same key.
.. class:: CipherContext
- When calling ``encryptor()`` or ``decryptor()`` on a ``BlockCipher`` object
+ When calling ``encryptor()`` or ``decryptor()`` on a ``Cipher`` object
you will receive a return object conforming to the ``CipherContext``
interface. You can then call ``update(data)`` with data until you have fed
everything into the context. Once that is done call ``finalize()`` to
@@ -72,9 +71,9 @@ where the encrypter and decrypter both use the same key.
:param bytes data: The data you wish to pass into the context.
:return bytes: Returns the data that was encrypted or decrypted.
- When the ``BlockCipher`` was constructed in a mode turns it into a
+ When the ``Cipher`` was constructed in a mode that turns it into a
stream cipher (e.g.
- :class:`cryptography.hazmat.primitives.block.modes.CTR`), this will
+ :class:`cryptography.hazmat.primitives.ciphers.modes.CTR`), this will
return bytes immediately, however in other modes it will return chunks,
whose size is determined by the cipher's block size.
@@ -82,10 +81,10 @@ where the encrypter and decrypter both use the same key.
:return bytes: Returns the remainder of the data.
-Ciphers
-~~~~~~~
+Algorithms
+~~~~~~~~~~
-.. currentmodule:: cryptography.hazmat.primitives.block.ciphers
+.. currentmodule:: cryptography.hazmat.primitives.ciphers.algorithms
.. class:: AES(key)
@@ -153,7 +152,7 @@ Weak Ciphers
Modes
~~~~~
-.. currentmodule:: cryptography.hazmat.primitives.block.modes
+.. currentmodule:: cryptography.hazmat.primitives.ciphers.modes
.. class:: CBC(initialization_vector)