aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_ciphers.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-10-16 16:55:40 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-10-16 16:55:40 -0700
commite761f8b33519104605b14cf8a24e9f68bd23b624 (patch)
tree672968fa7c23790bc9f5c9cd3c779adce09fae8c /tests/primitives/test_ciphers.py
parent62ebc7e212a92a13c3836de5d129cb93f40a128d (diff)
parent169dee88faa7c46b5551b89cf97a1b30c0a1c6ea (diff)
downloadcryptography-e761f8b33519104605b14cf8a24e9f68bd23b624.tar.gz
cryptography-e761f8b33519104605b14cf8a24e9f68bd23b624.tar.bz2
cryptography-e761f8b33519104605b14cf8a24e9f68bd23b624.zip
Merge branch 'master' into triple-des
Also moved most of the tests to the new format except for one which doesn't yet have an obvious translation Conflicts: cryptography/primitives/block/ciphers.py tests/primitives/test_nist.py
Diffstat (limited to 'tests/primitives/test_ciphers.py')
-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 5ee9f223..27d35850 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
+from cryptography.primitives.block.ciphers import AES, Camellia
class TestAES(object):
@@ -33,3 +33,18 @@ class TestAES(object):
def test_invalid_key_size(self):
with pytest.raises(ValueError):
AES(binascii.unhexlify(b"0" * 12))
+
+
+class TestCamellia(object):
+ @pytest.mark.parametrize(("key", "keysize"), [
+ (b"0" * 32, 128),
+ (b"0" * 48, 192),
+ (b"0" * 64, 256),
+ ])
+ def test_key_size(self, key, keysize):
+ cipher = Camellia(binascii.unhexlify(key))
+ assert cipher.key_size == keysize
+
+ def test_invalid_key_size(self):
+ with pytest.raises(ValueError):
+ Camellia(binascii.unhexlify(b"0" * 12))