aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/dsa.py3
-rw-r--r--src/cryptography/hazmat/backends/openssl/ec.py2
-rw-r--r--src/cryptography/hazmat/backends/openssl/rsa.py3
3 files changed, 8 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/dsa.py b/src/cryptography/hazmat/backends/openssl/dsa.py
index f84857ff..f1bb6d9b 100644
--- a/src/cryptography/hazmat/backends/openssl/dsa.py
+++ b/src/cryptography/hazmat/backends/openssl/dsa.py
@@ -29,6 +29,9 @@ def _truncate_digest_for_dsa(dsa_cdata, digest, backend):
@utils.register_interface(AsymmetricVerificationContext)
class _DSAVerificationContext(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
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
diff --git a/src/cryptography/hazmat/backends/openssl/rsa.py b/src/cryptography/hazmat/backends/openssl/rsa.py
index 822c7304..8e32eb02 100644
--- a/src/cryptography/hazmat/backends/openssl/rsa.py
+++ b/src/cryptography/hazmat/backends/openssl/rsa.py
@@ -337,6 +337,9 @@ class _RSASignatureContext(object):
@utils.register_interface(AsymmetricVerificationContext)
class _RSAVerificationContext(object):
def __init__(self, backend, public_key, signature, padding, algorithm):
+ if not isinstance(signature, bytes):
+ raise TypeError("signature must be bytes.")
+
self._backend = backend
self._public_key = public_key
self._signature = signature