diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2020-01-12 18:35:52 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2020-01-12 19:35:51 -0500 |
commit | f95abfeb6103a75741fe0b497bbc0fee24eddb6a (patch) | |
tree | 147859f294e254d78a735d6a55990851d634ad5d /tests/wycheproof/test_rsa.py | |
parent | fdd80ec89aa8f58b2d3bc6aaa51d74f4ea17d541 (diff) | |
download | cryptography-f95abfeb6103a75741fe0b497bbc0fee24eddb6a.tar.gz cryptography-f95abfeb6103a75741fe0b497bbc0fee24eddb6a.tar.bz2 cryptography-f95abfeb6103a75741fe0b497bbc0fee24eddb6a.zip |
Refs #5075 -- use rsa_signature_*.json from wycheproof (#5078)
* Refs #5075 -- use rsa_signature_*.json from wycheproof
* for azure
Diffstat (limited to 'tests/wycheproof/test_rsa.py')
-rw-r--r-- | tests/wycheproof/test_rsa.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/wycheproof/test_rsa.py b/tests/wycheproof/test_rsa.py index 112805b4..92fed2b0 100644 --- a/tests/wycheproof/test_rsa.py +++ b/tests/wycheproof/test_rsa.py @@ -20,6 +20,13 @@ _DIGESTS = { "SHA-256": hashes.SHA256(), "SHA-384": hashes.SHA384(), "SHA-512": hashes.SHA512(), + # Not supported by OpenSSL for RSA signing + "SHA-512/224": None, + "SHA-512/256": None, + "SHA3-224": hashes.SHA3_224(), + "SHA3-256": hashes.SHA3_256(), + "SHA3-384": hashes.SHA3_384(), + "SHA3-512": hashes.SHA3_512(), } @@ -55,12 +62,24 @@ def should_verify(backend, wycheproof): "rsa_signature_test.json", "rsa_signature_2048_sha224_test.json", "rsa_signature_2048_sha256_test.json", + "rsa_signature_2048_sha384_test.json", "rsa_signature_2048_sha512_test.json", + "rsa_signature_2048_sha512_224_test.json", + "rsa_signature_2048_sha512_256_test.json", + "rsa_signature_2048_sha3_224_test.json", + "rsa_signature_2048_sha3_256_test.json", + "rsa_signature_2048_sha3_384_test.json", + "rsa_signature_2048_sha3_512_test.json", "rsa_signature_3072_sha256_test.json", "rsa_signature_3072_sha384_test.json", "rsa_signature_3072_sha512_test.json", + "rsa_signature_3072_sha512_256_test.json", + "rsa_signature_3072_sha3_256_test.json", + "rsa_signature_3072_sha3_384_test.json", + "rsa_signature_3072_sha3_512_test.json", "rsa_signature_4096_sha384_test.json", "rsa_signature_4096_sha512_test.json", + "rsa_signature_4096_sha512_256_test.json", ) def test_rsa_pkcs1v15_signature(backend, wycheproof): key = serialization.load_der_public_key( @@ -68,6 +87,9 @@ def test_rsa_pkcs1v15_signature(backend, wycheproof): ) digest = _DIGESTS[wycheproof.testgroup["sha"]] + if digest is None or not backend.hash_supported(digest): + pytest.skip("Hash {} not supported".format(digest)) + if should_verify(backend, wycheproof): key.verify( binascii.unhexlify(wycheproof.testcase["sig"]), |