Skip to content

Commit f95abfe

Browse files
alexreaperhulk
authored andcommitted
Refs pyca#5075 -- use rsa_signature_*.json from wycheproof (pyca#5078)
* Refs pyca#5075 -- use rsa_signature_*.json from wycheproof * for azure
1 parent fdd80ec commit f95abfe

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

tests/wycheproof/test_rsa.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
"SHA-256": hashes.SHA256(),
2121
"SHA-384": hashes.SHA384(),
2222
"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(),
2330
}
2431

2532

@@ -55,19 +62,34 @@ def should_verify(backend, wycheproof):
5562
"rsa_signature_test.json",
5663
"rsa_signature_2048_sha224_test.json",
5764
"rsa_signature_2048_sha256_test.json",
65+
"rsa_signature_2048_sha384_test.json",
5866
"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",
5973
"rsa_signature_3072_sha256_test.json",
6074
"rsa_signature_3072_sha384_test.json",
6175
"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",
6280
"rsa_signature_4096_sha384_test.json",
6381
"rsa_signature_4096_sha512_test.json",
82+
"rsa_signature_4096_sha512_256_test.json",
6483
)
6584
def test_rsa_pkcs1v15_signature(backend, wycheproof):
6685
key = serialization.load_der_public_key(
6786
binascii.unhexlify(wycheproof.testgroup["keyDer"]), backend
6887
)
6988
digest = _DIGESTS[wycheproof.testgroup["sha"]]
7089

90+
if digest is None or not backend.hash_supported(digest):
91+
pytest.skip("Hash {} not supported".format(digest))
92+
7193
if should_verify(backend, wycheproof):
7294
key.verify(
7395
binascii.unhexlify(wycheproof.testcase["sig"]),

0 commit comments

Comments
 (0)