|
20 | 20 | "SHA-256": hashes.SHA256(), |
21 | 21 | "SHA-384": hashes.SHA384(), |
22 | 22 | "SHA-512": hashes.SHA512(), |
| 23 | + # Not supported by OpenSSL for RSA signing |
| 24 | + "SHA-512/224": None, |
| 25 | + "SHA-512/256": None, |
| 26 | + "SHA3-224": hashes.SHA3_224(), |
| 27 | + "SHA3-256": hashes.SHA3_256(), |
| 28 | + "SHA3-384": hashes.SHA3_384(), |
| 29 | + "SHA3-512": hashes.SHA3_512(), |
23 | 30 | } |
24 | 31 |
|
25 | 32 |
|
@@ -55,19 +62,34 @@ def should_verify(backend, wycheproof): |
55 | 62 | "rsa_signature_test.json", |
56 | 63 | "rsa_signature_2048_sha224_test.json", |
57 | 64 | "rsa_signature_2048_sha256_test.json", |
| 65 | + "rsa_signature_2048_sha384_test.json", |
58 | 66 | "rsa_signature_2048_sha512_test.json", |
| 67 | + "rsa_signature_2048_sha512_224_test.json", |
| 68 | + "rsa_signature_2048_sha512_256_test.json", |
| 69 | + "rsa_signature_2048_sha3_224_test.json", |
| 70 | + "rsa_signature_2048_sha3_256_test.json", |
| 71 | + "rsa_signature_2048_sha3_384_test.json", |
| 72 | + "rsa_signature_2048_sha3_512_test.json", |
59 | 73 | "rsa_signature_3072_sha256_test.json", |
60 | 74 | "rsa_signature_3072_sha384_test.json", |
61 | 75 | "rsa_signature_3072_sha512_test.json", |
| 76 | + "rsa_signature_3072_sha512_256_test.json", |
| 77 | + "rsa_signature_3072_sha3_256_test.json", |
| 78 | + "rsa_signature_3072_sha3_384_test.json", |
| 79 | + "rsa_signature_3072_sha3_512_test.json", |
62 | 80 | "rsa_signature_4096_sha384_test.json", |
63 | 81 | "rsa_signature_4096_sha512_test.json", |
| 82 | + "rsa_signature_4096_sha512_256_test.json", |
64 | 83 | ) |
65 | 84 | def test_rsa_pkcs1v15_signature(backend, wycheproof): |
66 | 85 | key = serialization.load_der_public_key( |
67 | 86 | binascii.unhexlify(wycheproof.testgroup["keyDer"]), backend |
68 | 87 | ) |
69 | 88 | digest = _DIGESTS[wycheproof.testgroup["sha"]] |
70 | 89 |
|
| 90 | + if digest is None or not backend.hash_supported(digest): |
| 91 | + pytest.skip("Hash {} not supported".format(digest)) |
| 92 | + |
71 | 93 | if should_verify(backend, wycheproof): |
72 | 94 | key.verify( |
73 | 95 | binascii.unhexlify(wycheproof.testcase["sig"]), |
|
0 commit comments