diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-03-06 14:10:59 -0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-03-06 14:10:59 -0800 |
commit | 8b347932fb3612e622d07643af62ed939976b9cb (patch) | |
tree | 72837619ab4e9064ff50649f245ed3ee316ce66e /docs/hazmat/primitives/asymmetric | |
parent | 25d24de1417844f95b247365a3fb24f17bf120ff (diff) | |
parent | 1e8aa9b09351bf0fb47bed24defc4d9f37560e31 (diff) | |
download | cryptography-8b347932fb3612e622d07643af62ed939976b9cb.tar.gz cryptography-8b347932fb3612e622d07643af62ed939976b9cb.tar.bz2 cryptography-8b347932fb3612e622d07643af62ed939976b9cb.zip |
Merge branch 'master' into exception-heirarchy-refactor
Conflicts:
cryptography/hazmat/backends/openssl/backend.py
Diffstat (limited to 'docs/hazmat/primitives/asymmetric')
-rw-r--r-- | docs/hazmat/primitives/asymmetric/rsa.rst | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/docs/hazmat/primitives/asymmetric/rsa.rst b/docs/hazmat/primitives/asymmetric/rsa.rst index 682820b3..7943981e 100644 --- a/docs/hazmat/primitives/asymmetric/rsa.rst +++ b/docs/hazmat/primitives/asymmetric/rsa.rst @@ -111,6 +111,49 @@ RSA or ``modulus`` do not match the bounds specified in :rfc:`3447`. + .. method:: verifier(signature, padding, algorithm, backend) + + .. versionadded:: 0.3 + + Verify data was signed by the private key associated with this public + key. + + .. 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.RSAPrivateKey.generate( + ... public_exponent=65537, + ... key_size=2048, + ... backend=default_backend() + ... ) + >>> signer = private_key.signer(padding.PKCS1v15(), hashes.SHA256(), default_backend()) + >>> 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, padding.PKCS1v15(), hashes.SHA256(), default_backend()) + >>> verifier.update(data) + >>> verifier.verify() + + :param bytes signature: The signature to verify. + + :param padding: An instance of a + :class:`~cryptography.hazmat.primitives.interfaces.AsymmetricPadding` + provider. + + :param algorithm: An instance of a + :class:`~cryptography.hazmat.primitives.interfaces.HashAlgorithm` + provider. + + :param backend: A + :class:`~cryptography.hazmat.backends.interfaces.RSABackend` + provider. + + :returns: + :class:`~cryptography.hazmat.primitives.interfaces.AsymmetricVerificationContext` + .. _`RSA`: https://en.wikipedia.org/wiki/RSA_(cryptosystem) .. _`public-key`: https://en.wikipedia.org/wiki/Public-key_cryptography .. _`use 65537`: http://www.daemonology.net/blog/2009-06-11-cryptographic-right-answers.html |