diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-20 15:45:51 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-24 08:25:29 -0600 |
commit | a63083a7427a6e394bb3b6c0e841dd0e3172733c (patch) | |
tree | 06ac49a59a64d011d209fca6692d9500c7649960 /docs/hazmat | |
parent | afad62a250b2cd7d3107360e817652a1affc942c (diff) | |
download | cryptography-a63083a7427a6e394bb3b6c0e841dd0e3172733c.tar.gz cryptography-a63083a7427a6e394bb3b6c0e841dd0e3172733c.tar.bz2 cryptography-a63083a7427a6e394bb3b6c0e841dd0e3172733c.zip |
simplify examples per dreid's suggestion
Diffstat (limited to 'docs/hazmat')
-rw-r--r-- | docs/hazmat/primitives/asymmetric/rsa.rst | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/docs/hazmat/primitives/asymmetric/rsa.rst b/docs/hazmat/primitives/asymmetric/rsa.rst index 160ff181..7250066a 100644 --- a/docs/hazmat/primitives/asymmetric/rsa.rst +++ b/docs/hazmat/primitives/asymmetric/rsa.rst @@ -69,24 +69,6 @@ provider. .. doctest:: - >>> from cryptography.hazmat.backends import default_backend - >>> from cryptography.hazmat.primitives import hashes - >>> from cryptography.hazmat.primitives.asymmetric import rsa, padding - >>> private_key = rsa.generate_private_key( - ... public_exponent=65537, - ... key_size=2048, - ... backend=default_backend() - ... ) - >>> signer = private_key.signer( - ... padding.PSS( - ... mgf=padding.MGF1(hashes.SHA256()), - ... salt_length=padding.PSS.MAX_LENGTH - ... ), - ... hashes.SHA256() - ... ) - >>> data = b"this is some data I'd like to sign" - >>> signer.update(data) - >>> signature = signer.finalize() >>> public_key = private_key.public_key() >>> verifier = public_key.verifier( ... signature, @@ -96,6 +78,7 @@ provider. ... ), ... hashes.SHA256() ... ) + >>> data = b"this is some data I'd like to sign" >>> verifier.update(data) >>> verifier.verify() @@ -136,27 +119,6 @@ provider. .. doctest:: - >>> from cryptography.hazmat.backends import default_backend - >>> from cryptography.hazmat.primitives import hashes - >>> from cryptography.hazmat.primitives.asymmetric import padding - - >>> # Generate a key - >>> private_key = rsa.generate_private_key( - ... public_exponent=65537, - ... key_size=2048, - ... backend=default_backend() - ... ) - >>> public_key = private_key.public_key() - >>> # encrypt some data - >>> ciphertext = public_key.encrypt( - ... b"encrypted data", - ... padding.OAEP( - ... mgf=padding.MGF1(algorithm=hashes.SHA1()), - ... algorithm=hashes.SHA1(), - ... label=None - ... ) - ... ) - >>> # Now do the actual decryption >>> plaintext = private_key.decrypt( ... ciphertext, ... padding.OAEP( |