From f95abfeb6103a75741fe0b497bbc0fee24eddb6a Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 12 Jan 2020 18:35:52 -0600 Subject: Refs #5075 -- use rsa_signature_*.json from wycheproof (#5078) * Refs #5075 -- use rsa_signature_*.json from wycheproof * for azure --- tests/wycheproof/test_rsa.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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"]), -- cgit v1.2.3