aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-03-03 10:14:54 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-03-03 10:14:54 -0800
commitc898e8d1328e6c0c65c13923a9581f7b41911ae3 (patch)
tree2b13c903789b4862ebca583c3bf4061e21d50df3 /cryptography
parent6963d50ff7c867d49bbd62243c3aa0a861a8e7b6 (diff)
parent9ab901df604177ea331b59b94d513af50af8f8e1 (diff)
downloadcryptography-c898e8d1328e6c0c65c13923a9581f7b41911ae3.tar.gz
cryptography-c898e8d1328e6c0c65c13923a9581f7b41911ae3.tar.bz2
cryptography-c898e8d1328e6c0c65c13923a9581f7b41911ae3.zip
Merge pull request #720 from Ayrx/hotp-length-type-check
Added length type check to HOTP and corresponding test
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/hazmat/primitives/twofactor/hotp.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/cryptography/hazmat/primitives/twofactor/hotp.py b/cryptography/hazmat/primitives/twofactor/hotp.py
index 88bde715..83260225 100644
--- a/cryptography/hazmat/primitives/twofactor/hotp.py
+++ b/cryptography/hazmat/primitives/twofactor/hotp.py
@@ -27,6 +27,9 @@ class HOTP(object):
if len(key) < 16:
raise ValueError("Key length has to be at least 128 bits.")
+ if not isinstance(length, six.integer_types):
+ raise TypeError("Length parameter must be an integer type")
+
if length < 6 or length > 8:
raise ValueError("Length of HOTP has to be between 6 to 8.")