From 6fbdd3c3456c27057d91581cbcb986e58dac0609 Mon Sep 17 00:00:00 2001 From: Tim Heckman Date: Wed, 17 Oct 2012 21:09:43 -0400 Subject: 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 --- tests/test_bigfile.py | 2 +- tests/test_pkcs1.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') 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.''' -- cgit v1.2.1