(backend, wycheproof)
| 67 | "rsa_signature_8192_sha512_test.json", |
| 68 | ) |
| 69 | def test_rsa_pkcs1v15_signature(backend, wycheproof): |
| 70 | key = wycheproof.cache_value_to_group( |
| 71 | "cached_key", |
| 72 | lambda: serialization.load_der_public_key( |
| 73 | binascii.unhexlify(wycheproof.testgroup["publicKeyDer"]), |
| 74 | ), |
| 75 | ) |
| 76 | assert isinstance(key, rsa.RSAPublicKey) |
| 77 | digest = _DIGESTS[wycheproof.testgroup["sha"]] |
| 78 | |
| 79 | if digest is None or not backend.hash_supported(digest): |
| 80 | pytest.skip( |
| 81 | "Hash {} not supported".format(wycheproof.testgroup["sha"]) |
| 82 | ) |
| 83 | |
| 84 | if should_verify(backend, wycheproof): |
| 85 | key.verify( |
| 86 | binascii.unhexlify(wycheproof.testcase["sig"]), |
| 87 | binascii.unhexlify(wycheproof.testcase["msg"]), |
| 88 | padding.PKCS1v15(), |
| 89 | digest, |
| 90 | ) |
| 91 | else: |
| 92 | with pytest.raises(InvalidSignature): |
| 93 | key.verify( |
| 94 | binascii.unhexlify(wycheproof.testcase["sig"]), |
| 95 | binascii.unhexlify(wycheproof.testcase["msg"]), |
| 96 | padding.PKCS1v15(), |
| 97 | digest, |
| 98 | ) |
| 99 | |
| 100 | |
| 101 | @wycheproof_tests( |
nothing calls this directly
no test coverage detected