aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_chacha20.py
diff options
context:
space:
mode:
authorVladyslav Moisieienkov <vladyslav.moisieienkov@gmail.com>2018-06-20 14:21:33 +0200
committerAlex Gaynor <alex.gaynor@gmail.com>2018-06-20 05:21:33 -0700
commit2d0afd3485a6349924f921d12dc94a302999ae20 (patch)
tree43ef9d2396ba5ffdbe33cc0903fd4546b7f7fe6c /tests/hazmat/primitives/test_chacha20.py
parentd88d721343828accacefca701a3d542365cd6d59 (diff)
downloadcryptography-2d0afd3485a6349924f921d12dc94a302999ae20.tar.gz
cryptography-2d0afd3485a6349924f921d12dc94a302999ae20.tar.bz2
cryptography-2d0afd3485a6349924f921d12dc94a302999ae20.zip
Add clearer message when key type is not bytes (#4289)
* Add clearer message in Cipher when key is not bytes * Change location of key type check to verify_key_size function * Replace formated error message with static * Add key type check tests to all ciphers constructors * Change key type error message to lowercase
Diffstat (limited to 'tests/hazmat/primitives/test_chacha20.py')
-rw-r--r--tests/hazmat/primitives/test_chacha20.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_chacha20.py b/tests/hazmat/primitives/test_chacha20.py
index 16ef97ed..33730d91 100644
--- a/tests/hazmat/primitives/test_chacha20.py
+++ b/tests/hazmat/primitives/test_chacha20.py
@@ -58,3 +58,7 @@ class TestChaCha20(object):
with pytest.raises(TypeError):
algorithms.ChaCha20(b"0" * 32, object())
+
+ def test_invalid_key_type(self):
+ with pytest.raises(TypeError, match="key must be bytes"):
+ algorithms.ChaCha20(u"0" * 32, b"0" * 16)