From 38df44151cdc6591385c4ec1691e782d05c8aec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Pitucha?= Date: Wed, 12 Aug 2015 15:30:25 +1000 Subject: Enforce signature type in ECDSA and add tests Ensure that ECDSA signatures are bytes to match RSA/DSA and add tests for all three. --- tests/hazmat/primitives/test_ec.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/hazmat/primitives/test_ec.py') diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py index 20465a2d..f2e340be 100644 --- a/tests/hazmat/primitives/test_ec.py +++ b/tests/hazmat/primitives/test_ec.py @@ -710,3 +710,12 @@ class TestEllipticCurvePEMPublicKeySerialization(object): key.public_bytes( serialization.Encoding.PEM, serialization.PublicFormat.PKCS1 ) + + +@pytest.mark.requires_backend_interface(interface=EllipticCurveBackend) +class TestECDSAVerification(object): + def test_signature_not_bytes(self, backend): + key = ec.generate_private_key(ec.SECP192R1(), backend) + public_key = key.public_key() + with pytest.raises(TypeError): + public_key.verifier(1234, ec.ECDSA(hashes.SHA256())) -- cgit v1.2.3