add RSA verification support
diff --git a/docs/exceptions.rst b/docs/exceptions.rst
index 0982426..7f9ae34 100644
--- a/docs/exceptions.rst
+++ b/docs/exceptions.rst
@@ -10,8 +10,8 @@
.. class:: InvalidSignature
- This is raised when the verify method of a hash context's computed digest
- does not match the expected digest.
+ This is raised when signature verification fails. This can occur with
+ HMAC or asymmetric key signature validation.
.. class:: NotYetFinalized
diff --git a/docs/hazmat/primitives/asymmetric/rsa.rst b/docs/hazmat/primitives/asymmetric/rsa.rst
index 682820b..528b532 100644
--- a/docs/hazmat/primitives/asymmetric/rsa.rst
+++ b/docs/hazmat/primitives/asymmetric/rsa.rst
@@ -111,6 +111,42 @@
or ``modulus`` do not match the bounds specified in
:rfc:`3447`.
+ .. method:: verifier(signature, padding, algorithm, backend)
+
+ .. versionadded:: 0.3
+
+ :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`
+
+ .. 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(65537, 2048, default_backend())
+ >>> signer = private_key.signer(padding.PKCS1(), 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.PKCS1(), hashes.SHA256(), default_backend())
+ >>> verifier.update(data)
+ >>> verifier.verify()
+
.. _`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
diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst
index 5be3dd9..5311322 100644
--- a/docs/hazmat/primitives/interfaces.rst
+++ b/docs/hazmat/primitives/interfaces.rst
@@ -254,8 +254,8 @@
.. method:: verify()
- :raises cryptography.exceptions.InvalidSignature: If signature does not
- validate.
+ :raises :class:`~cryptography.exceptions.InvalidAsymmetricSignature`: If
+ the signature does not validate.
.. class:: AsymmetricPadding