aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-10-21 19:35:57 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-10-21 19:35:57 -0700
commit7a3338b9c27397ac9dff5331c3390c83d3139938 (patch)
treeeda0a404800c4d12499e31953ae9064a9c812314 /tests
parenta4ce161dee13466e0e1ff2c100ccbe74c2b271f2 (diff)
downloadcryptography-7a3338b9c27397ac9dff5331c3390c83d3139938.tar.gz
cryptography-7a3338b9c27397ac9dff5331c3390c83d3139938.tar.bz2
cryptography-7a3338b9c27397ac9dff5331c3390c83d3139938.zip
Tests for all the keysizes
Diffstat (limited to 'tests')
-rw-r--r--tests/primitives/test_ciphers.py17
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))