diff options
author | Tim Heckman <tim+code@timheckman.net> | 2012-10-17 21:09:43 -0400 |
---|---|---|
committer | Tim Heckman <tim+code@timheckman.net> | 2012-10-17 21:09:43 -0400 |
commit | 6fbdd3c3456c27057d91581cbcb986e58dac0609 (patch) | |
tree | 0c3311d211dd44e73a177cd424fa27f50cdec73c /tests | |
parent | d8d6d933f67d3967fbbb4d87a34da52166d8bf41 (diff) | |
download | rsa-6fbdd3c3456c27057d91581cbcb986e58dac0609.tar.gz |
rsa.pkcs1.verify() should return True when successful
- when verification passes verify() will return True, instead of
None. If verification fails the function will still raise a
rsa.pkcs1.VerificationError for legacy purposes.
- update the docs to note that the verify() function returns True
when successful
- write unit tests to verify this new behavior
This commit passes all build tests:
Ran 44 tests in 1.217s
OK
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_bigfile.py | 2 | ||||
-rw-r--r-- | tests/test_pkcs1.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_bigfile.py b/tests/test_bigfile.py index 974da8b..86bcbba 100644 --- a/tests/test_bigfile.py +++ b/tests/test_bigfile.py @@ -51,7 +51,7 @@ class BigfileTest(unittest2.TestCase): # Check the signature msgfile.seek(0) - pkcs1.verify(msgfile, signature, pub_key) + self.assertTrue(pkcs1.verify(msgfile, signature, pub_key)) # Alter the message, re-check msgfile = BytesIO(b('123456sybren')) diff --git a/tests/test_pkcs1.py b/tests/test_pkcs1.py index 55098e2..d5882df 100644 --- a/tests/test_pkcs1.py +++ b/tests/test_pkcs1.py @@ -64,7 +64,7 @@ class SignatureTest(unittest2.TestCase): signature = pkcs1.sign(message, self.priv, 'SHA-256') print("\tSignature: %r" % signature) - pkcs1.verify(message, signature, self.pub) + self.assertTrue(pkcs1.verify(message, signature, self.pub)) def test_alter_message(self): '''Altering the message should let the verification fail.''' |