diff options
author | Alex Stapleton <alexs@prol.etari.at> | 2014-04-01 12:04:44 +0100 |
---|---|---|
committer | Alex Stapleton <alexs@prol.etari.at> | 2014-04-01 12:11:12 +0100 |
commit | 976945d4078bcd16eb5a95526e6b26ace7b19bd3 (patch) | |
tree | 49d741ce3e25aa51638300ade46f2c643e77ce3b /cryptography | |
parent | 621635712962267e589b19fb2292a764e5ad71de (diff) | |
download | cryptography-976945d4078bcd16eb5a95526e6b26ace7b19bd3.tar.gz cryptography-976945d4078bcd16eb5a95526e6b26ace7b19bd3.tar.bz2 cryptography-976945d4078bcd16eb5a95526e6b26ace7b19bd3.zip |
Add _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM
Diffstat (limited to 'cryptography')
-rw-r--r-- | cryptography/exceptions.py | 1 | ||||
-rw-r--r-- | cryptography/hazmat/backends/multibackend.py | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/cryptography/exceptions.py b/cryptography/exceptions.py index d2782be6..b4ee8feb 100644 --- a/cryptography/exceptions.py +++ b/cryptography/exceptions.py @@ -20,6 +20,7 @@ class _Reasons(object): UNSUPPORTED_CIPHER = object() UNSUPPORTED_PADDING = object() UNSUPPORTED_MGF = object() + UNSUPPORTED_PUBLIC_KEY_ALGORITHM = object() class UnsupportedAlgorithm(Exception): diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py index 2a1ec439..aa649dd3 100644 --- a/cryptography/hazmat/backends/multibackend.py +++ b/cryptography/hazmat/backends/multibackend.py @@ -126,16 +126,19 @@ class MultiBackend(object): def generate_rsa_private_key(self, public_exponent, key_size): for b in self._filtered_backends(RSABackend): return b.generate_rsa_private_key(public_exponent, key_size) - raise UnsupportedAlgorithm("RSA is not supported by the backend") + raise UnsupportedAlgorithm("RSA is not supported by the backend", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) def create_rsa_signature_ctx(self, private_key, padding, algorithm): for b in self._filtered_backends(RSABackend): return b.create_rsa_signature_ctx(private_key, padding, algorithm) - raise UnsupportedAlgorithm("RSA is not supported by the backend") + raise UnsupportedAlgorithm("RSA is not supported by the backend", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) def create_rsa_verification_ctx(self, public_key, signature, padding, algorithm): for b in self._filtered_backends(RSABackend): return b.create_rsa_verification_ctx(public_key, signature, padding, algorithm) - raise UnsupportedAlgorithm("RSA is not supported by the backend") + raise UnsupportedAlgorithm("RSA is not supported by the backend", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) |