aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2014-04-01 12:02:02 +0100
committerAlex Stapleton <alexs@prol.etari.at>2014-04-01 12:11:08 +0100
commit621635712962267e589b19fb2292a764e5ad71de (patch)
tree2a05ae3b20bd56ed968e105ba0e45a72e79d372d /cryptography
parent476682af2d4a9438026e69b6c1f3500c19f2f200 (diff)
downloadcryptography-621635712962267e589b19fb2292a764e5ad71de.tar.gz
cryptography-621635712962267e589b19fb2292a764e5ad71de.tar.bz2
cryptography-621635712962267e589b19fb2292a764e5ad71de.zip
Add _Reasons.UNSUPPORTED_MGF
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/exceptions.py1
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py6
2 files changed, 5 insertions, 2 deletions
diff --git a/cryptography/exceptions.py b/cryptography/exceptions.py
index 4b4d4c37..d2782be6 100644
--- a/cryptography/exceptions.py
+++ b/cryptography/exceptions.py
@@ -19,6 +19,7 @@ class _Reasons(object):
UNSUPPORTED_HASH = object()
UNSUPPORTED_CIPHER = object()
UNSUPPORTED_PADDING = object()
+ UNSUPPORTED_MGF = object()
class UnsupportedAlgorithm(Exception):
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 753717d4..3293741c 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -731,7 +731,8 @@ class _RSASignatureContext(object):
elif isinstance(padding, PSS):
if not isinstance(padding._mgf, MGF1):
raise UnsupportedAlgorithm(
- "Only MGF1 is supported by this backend"
+ "Only MGF1 is supported by this backend",
+ _Reasons.UNSUPPORTED_MGF
)
# Size of key in bytes - 2 is the maximum
@@ -915,7 +916,8 @@ class _RSAVerificationContext(object):
elif isinstance(padding, PSS):
if not isinstance(padding._mgf, MGF1):
raise UnsupportedAlgorithm(
- "Only MGF1 is supported by this backend"
+ "Only MGF1 is supported by this backend",
+ _Reasons.UNSUPPORTED_MGF
)
# Size of key in bytes - 2 is the maximum