aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_rsa.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat/primitives/test_rsa.py')
-rw-r--r--tests/hazmat/primitives/test_rsa.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py
index cbb9be6f..7ce2746c 100644
--- a/tests/hazmat/primitives/test_rsa.py
+++ b/tests/hazmat/primitives/test_rsa.py
@@ -531,6 +531,35 @@ class TestRSASignature(object):
with pytest.raises(ValueError):
private_key.sign(digest, pss, prehashed_alg)
+ @pytest.mark.supported(
+ only_if=lambda backend: backend.rsa_padding_supported(
+ padding.PKCS1v15()
+ ),
+ skip_message="Does not support PKCS1v1.5."
+ )
+ def test_prehashed_unsupported_in_signer_ctx(self, backend):
+ private_key = RSA_KEY_512.private_key(backend)
+ with pytest.raises(TypeError):
+ private_key.signer(
+ padding.PKCS1v15(),
+ asym_utils.Prehashed(hashes.SHA1())
+ )
+
+ @pytest.mark.supported(
+ only_if=lambda backend: backend.rsa_padding_supported(
+ padding.PKCS1v15()
+ ),
+ skip_message="Does not support PKCS1v1.5."
+ )
+ def test_prehashed_unsupported_in_verifier_ctx(self, backend):
+ public_key = RSA_KEY_512.private_key(backend).public_key()
+ with pytest.raises(TypeError):
+ public_key.verifier(
+ b"0" * 64,
+ padding.PKCS1v15(),
+ asym_utils.Prehashed(hashes.SHA1())
+ )
+
@pytest.mark.requires_backend_interface(interface=RSABackend)
class TestRSAVerification(object):