aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_ciphers.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-09-27 13:43:06 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-06 17:31:31 -0500
commitdff22d4707a50b8164c5c6acd5521bcd91160cd1 (patch)
tree761787ecb9a65b941fcfd4907c16ee244f6bf9b4 /tests/primitives/test_ciphers.py
parent867b979b81aba0578d7241d6a38201214a976ace (diff)
downloadcryptography-dff22d4707a50b8164c5c6acd5521bcd91160cd1.tar.gz
cryptography-dff22d4707a50b8164c5c6acd5521bcd91160cd1.tar.bz2
cryptography-dff22d4707a50b8164c5c6acd5521bcd91160cd1.zip
Camellia block cipher support
* Tests for CBC, OFB, CFB, and ECB * Tests will be automatically skipped if camellia support is not present in your OpenSSL library (e.g. OS X 10.8 with default OpenSSL) * Test for unsupported cipher in create_block_cipher_context * Docs for the cipher
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))