diff options
author | David Reid <dreid@dreid.org> | 2013-11-01 15:11:45 -0700 |
---|---|---|
committer | David Reid <dreid@dreid.org> | 2013-11-01 15:11:45 -0700 |
commit | b864db11a3577ff6b117f6ce73e43f3c1e7b3e84 (patch) | |
tree | d7acb894e16504134c2d11f0207f325f707aab67 /cryptography/hazmat/primitives/hmac.py | |
parent | 9d65b613384b1d4781efd65588639ad68261e8d7 (diff) | |
download | cryptography-b864db11a3577ff6b117f6ce73e43f3c1e7b3e84.tar.gz cryptography-b864db11a3577ff6b117f6ce73e43f3c1e7b3e84.tar.bz2 cryptography-b864db11a3577ff6b117f6ce73e43f3c1e7b3e84.zip |
Enforce HMAC taking an instance of HashAlgorithm
Diffstat (limited to 'cryptography/hazmat/primitives/hmac.py')
-rw-r--r-- | cryptography/hazmat/primitives/hmac.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cryptography/hazmat/primitives/hmac.py b/cryptography/hazmat/primitives/hmac.py index fc5e777c..1457ed78 100644 --- a/cryptography/hazmat/primitives/hmac.py +++ b/cryptography/hazmat/primitives/hmac.py @@ -22,6 +22,8 @@ from cryptography.hazmat.primitives import interfaces class HMAC(object): def __init__(self, key, algorithm, ctx=None, backend=None): super(HMAC, self).__init__() + if not isinstance(algorithm, interfaces.HashAlgorithm): + raise TypeError("Expected instance of interfaces.HashAlgorithm.") self.algorithm = algorithm if backend is None: |