diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2020-06-11 20:22:01 +0200 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2020-06-11 20:22:30 +0200 |
commit | 9032802c2574bc4538f8f54843fd1996aaf396e4 (patch) | |
tree | 626e41d63447255540e7935bc8591d128a776343 /tests | |
parent | fb8772a34b9086567b4b51da5a2d62e641131828 (diff) | |
download | rsa-git-9032802c2574bc4538f8f54843fd1996aaf396e4.tar.gz |
Limit SHA3 support to Python 3.6+
The third-party library that adds support for this to Python 3.5 is a
binary package, and thus breaks the pure-Python nature of Python-RSA.
This should fix [#147](https://github.com/sybrenstuvel/python-rsa/issues/147).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_pkcs1.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_pkcs1.py b/tests/test_pkcs1.py index 702ce2d..f7baf7f 100644 --- a/tests/test_pkcs1.py +++ b/tests/test_pkcs1.py @@ -15,6 +15,7 @@ """Tests string operations.""" import struct +import sys import unittest import rsa @@ -101,6 +102,12 @@ class SignatureTest(unittest.TestCase): signature = pkcs1.sign(message, self.priv, 'SHA-256') self.assertEqual('SHA-256', pkcs1.verify(message, signature, self.pub)) + + @unittest.skipIf(sys.version_info < (3, 6), "SHA3 requires Python 3.6+") + def test_sign_verify_sha3(self): + """Test happy flow of sign and verify with SHA3-256""" + + message = b'je moeder' signature = pkcs1.sign(message, self.priv, 'SHA3-256') self.assertEqual('SHA3-256', pkcs1.verify(message, signature, self.pub)) |