aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTerry Chia <terrycwk1994@gmail.com>2016-07-16 22:22:32 +0800
committerPaul Kehrer <paul.l.kehrer@gmail.com>2016-07-16 08:22:32 -0600
commit69617caca7ff98f1a991b476669f1afcdfb01fb0 (patch)
treeeef6034da6f6ddc8faa691b7787c7b3d7389a79c /tests
parentc0f5a8272988c7b93b301d2b3a53cd6f1a350dff (diff)
downloadcryptography-69617caca7ff98f1a991b476669f1afcdfb01fb0.tar.gz
cryptography-69617caca7ff98f1a991b476669f1afcdfb01fb0.tar.bz2
cryptography-69617caca7ff98f1a991b476669f1afcdfb01fb0.zip
Add flag to toggle key length check for HOTP and TOTP. (#3012)
* Add an enforce_key_length parameter to HOTP and TOTP. * Document changes in docs. * Add some words to the wordlist. * Add versionadded to docs.
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/twofactor/test_hotp.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py
index ab5f93c5..4c561f70 100644
--- a/tests/hazmat/primitives/twofactor/test_hotp.py
+++ b/tests/hazmat/primitives/twofactor/test_hotp.py
@@ -35,6 +35,10 @@ class TestHOTP(object):
with pytest.raises(ValueError):
HOTP(secret, 6, SHA1(), backend)
+ def test_unenforced_invalid_kwy_length(self, backend):
+ secret = os.urandom(10)
+ HOTP(secret, 6, SHA1(), backend, enforce_key_length=False)
+
def test_invalid_hotp_length(self, backend):
secret = os.urandom(16)