diff options
author | Ayrx <terrycwk1994@gmail.com> | 2014-03-03 23:33:49 +0800 |
---|---|---|
committer | Ayrx <terrycwk1994@gmail.com> | 2014-03-03 23:33:49 +0800 |
commit | 5b83d9bf238343621e9bc6d2ba459652cd3a01b7 (patch) | |
tree | 703bf2193797a6b1d10f83d8681c2b9e4e9deca7 /cryptography | |
parent | 930eed8bcbea6f6250998f0ee042babd62667a9f (diff) | |
download | cryptography-5b83d9bf238343621e9bc6d2ba459652cd3a01b7.tar.gz cryptography-5b83d9bf238343621e9bc6d2ba459652cd3a01b7.tar.bz2 cryptography-5b83d9bf238343621e9bc6d2ba459652cd3a01b7.zip |
Added length type check to HOTP and corresponding test
Diffstat (limited to 'cryptography')
-rw-r--r-- | cryptography/hazmat/primitives/twofactor/hotp.py | 3 |
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.") |