aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStanisław Pitucha <stanislaw.pitucha@hp.com>2015-08-12 15:30:25 +1000
committerStanisław Pitucha <stanislaw.pitucha@hp.com>2015-08-12 16:32:59 +1000
commit38df44151cdc6591385c4ec1691e782d05c8aec7 (patch)
treec3af40867c8f9e85731fd0df0dc861b0301b3f1c /src
parent305bee427aa5bf5908b74f384d90a29879ac7f6a (diff)
downloadcryptography-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 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/ec.py2
1 files changed, 2 insertions, 0 deletions
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