Merge pull request #1606 from reaperhulk/doc-dsa-keys
document DSA key we added long ago
diff --git a/docs/hazmat/primitives/symmetric-encryption.rst b/docs/hazmat/primitives/symmetric-encryption.rst
index 8d3769f..d532ad1 100644
--- a/docs/hazmat/primitives/symmetric-encryption.rst
+++ b/docs/hazmat/primitives/symmetric-encryption.rst
@@ -6,12 +6,6 @@
.. currentmodule:: cryptography.hazmat.primitives.ciphers
-.. testsetup::
-
- import binascii
- key = binascii.unhexlify(b"0" * 32)
- iv = binascii.unhexlify(b"0" * 32)
-
Symmetric encryption is a way to `encrypt`_ or hide the contents of material
where the sender and receiver both use the same secret key. Note that symmetric
@@ -35,9 +29,12 @@
.. doctest::
+ >>> import os
>>> from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
>>> from cryptography.hazmat.backends import default_backend
>>> backend = default_backend()
+ >>> key = os.urandom(32)
+ >>> iv = os.urandom(16)
>>> cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=backend)
>>> encryptor = cipher.encryptor()
>>> ct = encryptor.update(b"a secret message") + encryptor.finalize()