aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py1
-rw-r--r--docs/hazmat/primitives/interfaces.rst4
-rw-r--r--tests/hazmat/primitives/test_rsa.py8
3 files changed, 9 insertions, 4 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 0c4fbc3e..3eec244e 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -779,6 +779,7 @@ class _RSAVerificationContext(object):
len(self._signature),
evp_pkey
)
+ self._hash_ctx.finalize()
self._hash_ctx = None
if res != 1:
raise InvalidSignature
diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst
index 53113223..15ad1d1b 100644
--- a/docs/hazmat/primitives/interfaces.rst
+++ b/docs/hazmat/primitives/interfaces.rst
@@ -254,8 +254,8 @@ Asymmetric Interfaces
.. method:: verify()
- :raises :class:`~cryptography.exceptions.InvalidAsymmetricSignature`: If
- the signature does not validate.
+ :raises cryptography.exceptions.InvalidSignature: If the signature does
+ not validate.
.. class:: AsymmetricPadding
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py
index 649165b8..79323265 100644
--- a/tests/hazmat/primitives/test_rsa.py
+++ b/tests/hazmat/primitives/test_rsa.py
@@ -496,8 +496,12 @@ class TestRSAVerification(object):
key_size=512,
backend=backend
)
- public_key = private_key.public_key()
- public_key._modulus += 2
+ private_key2 = rsa.RSAPrivateKey.generate(
+ public_exponent=65537,
+ key_size=512,
+ backend=backend
+ )
+ public_key = private_key2.public_key()
signer = private_key.signer(padding.PKCS1v15(), hashes.SHA1(), backend)
signer.update(b"sign me")
signature = signer.finalize()