diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-03-27 11:04:21 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-03-27 11:04:21 -0700 |
commit | 3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8 (patch) | |
tree | 8285f420269fd636e63c9152143750922e48e869 /cryptography/hazmat/primitives/hmac.py | |
parent | 844c14a15884fb60871640576e30a61e6c4c2db1 (diff) | |
parent | 85a791f0fa061ec644f5bfca41ee6038eeef38eb (diff) | |
download | cryptography-3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8.tar.gz cryptography-3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8.tar.bz2 cryptography-3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8.zip |
Merge pull request #849 from public/changeup-exceptions-2-electric-boogaloo
Use a single tagged exception instead of a hierarchy
Diffstat (limited to 'cryptography/hazmat/primitives/hmac.py')
-rw-r--r-- | cryptography/hazmat/primitives/hmac.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cryptography/hazmat/primitives/hmac.py b/cryptography/hazmat/primitives/hmac.py index 0bcbb3cd..afbb2f75 100644 --- a/cryptography/hazmat/primitives/hmac.py +++ b/cryptography/hazmat/primitives/hmac.py @@ -17,7 +17,7 @@ import six from cryptography import utils from cryptography.exceptions import ( - AlreadyFinalized, InvalidSignature, UnsupportedInterface + AlreadyFinalized, InvalidSignature, UnsupportedAlgorithm, _Reasons ) from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives import constant_time, interfaces @@ -27,8 +27,10 @@ from cryptography.hazmat.primitives import constant_time, interfaces class HMAC(object): def __init__(self, key, algorithm, backend, ctx=None): if not isinstance(backend, HMACBackend): - raise UnsupportedInterface( - "Backend object does not implement HMACBackend") + raise UnsupportedAlgorithm( + "Backend object does not implement HMACBackend", + _Reasons.BACKEND_MISSING_INTERFACE + ) if not isinstance(algorithm, interfaces.HashAlgorithm): raise TypeError("Expected instance of interfaces.HashAlgorithm.") |