diff options
author | Stanisław Pitucha <stanislaw.pitucha@hp.com> | 2015-08-12 15:30:25 +1000 |
---|---|---|
committer | Stanisław Pitucha <stanislaw.pitucha@hp.com> | 2015-08-12 16:32:59 +1000 |
commit | 38df44151cdc6591385c4ec1691e782d05c8aec7 (patch) | |
tree | c3af40867c8f9e85731fd0df0dc861b0301b3f1c /tests/hazmat/primitives/test_rsa.py | |
parent | 305bee427aa5bf5908b74f384d90a29879ac7f6a (diff) | |
download | cryptography-38df44151cdc6591385c4ec1691e782d05c8aec7.tar.gz cryptography-38df44151cdc6591385c4ec1691e782d05c8aec7.tar.bz2 cryptography-38df44151cdc6591385c4ec1691e782d05c8aec7.zip |
Enforce signature type in ECDSA and add tests
Ensure that ECDSA signatures are bytes to match RSA/DSA and add tests
for all three.
Diffstat (limited to 'tests/hazmat/primitives/test_rsa.py')
-rw-r--r-- | tests/hazmat/primitives/test_rsa.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index 0c5f7042..0b83fd65 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -679,6 +679,23 @@ class TestRSAVerification(object): with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_PADDING): public_key.verifier(b"sig", DummyPadding(), hashes.SHA1()) + @pytest.mark.supported( + only_if=lambda backend: backend.rsa_padding_supported( + padding.PKCS1v15() + ), + skip_message="Does not support PKCS1v1.5." + ) + def test_signature_not_bytes(self, backend): + public_key = RSA_KEY_512.public_numbers.public_key(backend) + signature = 1234 + + with pytest.raises(TypeError): + public_key.verifier( + signature, + padding.PKCS1v15(), + hashes.SHA1() + ) + def test_padding_incorrect_type(self, backend): private_key = RSA_KEY_512.private_key(backend) public_key = private_key.public_key() |