diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-21 19:35:57 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-21 19:35:57 -0700 |
commit | 7a3338b9c27397ac9dff5331c3390c83d3139938 (patch) | |
tree | eda0a404800c4d12499e31953ae9064a9c812314 /tests/primitives/test_ciphers.py | |
parent | a4ce161dee13466e0e1ff2c100ccbe74c2b271f2 (diff) | |
download | cryptography-7a3338b9c27397ac9dff5331c3390c83d3139938.tar.gz cryptography-7a3338b9c27397ac9dff5331c3390c83d3139938.tar.bz2 cryptography-7a3338b9c27397ac9dff5331c3390c83d3139938.zip |
Tests for all the keysizes
Diffstat (limited to 'tests/primitives/test_ciphers.py')
-rw-r--r-- | tests/primitives/test_ciphers.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/primitives/test_ciphers.py b/tests/primitives/test_ciphers.py index 27d35850..17fcdbaf 100644 --- a/tests/primitives/test_ciphers.py +++ b/tests/primitives/test_ciphers.py @@ -17,7 +17,7 @@ import binascii import pytest -from cryptography.primitives.block.ciphers import AES, Camellia +from cryptography.primitives.block.ciphers import AES, Camellia, TripleDES class TestAES(object): @@ -48,3 +48,18 @@ class TestCamellia(object): def test_invalid_key_size(self): with pytest.raises(ValueError): Camellia(binascii.unhexlify(b"0" * 12)) + + +class TestTripleDES(object): + @pytest.mark.parametrize("key", [ + b"0" * 16, + b"0" * 32, + b"0" * 48, + ]) + def test_key_size(self, key): + cipher = TripleDES(binascii.unhexlify(key)) + assert cipher.key_size == 192 + + def test_invalid_key_size(self): + with pytest.raises(ValueError): + TripleDES(binascii.unhexlify(b"0" * 12)) |