summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2017-04-10 12:12:29 +0200
committerSybren A. Stüvel <sybren@stuvel.eu>2017-04-10 12:12:29 +0200
commit395b8d661566f15632b0fb0e36fb8ea453ad9bf3 (patch)
treec200069ad7eeca8868244fbea2f5a979c0f98ed8 /tests
parenta478d4c23a75c76f1e5587b3c08b1f3a1f2cbf8e (diff)
downloadrsa-git-395b8d661566f15632b0fb0e36fb8ea453ad9bf3.tar.gz
Feature request #78: Expose function to find the hash method of a signature
I've not used the name "find_method_hash" suggested in #78, as it's a bit vague. It's ok-ish for a private function `_find_method_hash`, but I thought `find_signature_hash` would be more descriptive.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pkcs1.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_pkcs1.py b/tests/test_pkcs1.py
index 2116284..a8afea7 100644
--- a/tests/test_pkcs1.py
+++ b/tests/test_pkcs1.py
@@ -76,7 +76,15 @@ class SignatureTest(unittest.TestCase):
message = b'je moeder'
signature = pkcs1.sign(message, self.priv, 'SHA-256')
- self.assertTrue(pkcs1.verify(message, signature, self.pub))
+ self.assertEqual('SHA-256', pkcs1.verify(message, signature, self.pub))
+
+ def test_find_signature_hash(self):
+ """Test happy flow of sign and find_signature_hash"""
+
+ message = b'je moeder'
+ signature = pkcs1.sign(message, self.priv, 'SHA-256')
+
+ self.assertEqual('SHA-256', pkcs1.find_signature_hash(signature, self.pub))
def test_alter_message(self):
"""Altering the message should let the verification fail."""