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. --- src/cryptography/hazmat/backends/openssl/ec.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/cryptography/hazmat/backends/openssl/ec.py b/src/cryptography/hazmat/backends/openssl/ec.py index 7d3afb94..b8692e49 100644 --- a/src/cryptography/hazmat/backends/openssl/ec.py +++ b/src/cryptography/hazmat/backends/openssl/ec.py @@ -119,6 +119,8 @@ class _ECDSASignatureContext(object): @utils.register_interface(AsymmetricVerificationContext) class _ECDSAVerificationContext(object): def __init__(self, backend, public_key, signature, algorithm): + if not isinstance(signature, bytes): + raise TypeError("signature must be bytes.") self._backend = backend self._public_key = public_key self._signature = signature -- cgit v1.2.3