aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_ciphers.py
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2013-10-22 09:38:29 -0700
committerDonald Stufft <donald@stufft.io>2013-10-22 09:38:29 -0700
commitab73ed9a6fadd69c7d394617fac6d6d2ab818abf (patch)
treeaac1716584b03ae125a675d6346dd454ec50d525 /tests/primitives/test_ciphers.py
parent2647636426d8a566cd1f0519cb67716e08715996 (diff)
parentfbcc564cd234d3b6c29ddd40fa66d50d39c5c8dd (diff)
downloadcryptography-ab73ed9a6fadd69c7d394617fac6d6d2ab818abf.tar.gz
cryptography-ab73ed9a6fadd69c7d394617fac6d6d2ab818abf.tar.bz2
cryptography-ab73ed9a6fadd69c7d394617fac6d6d2ab818abf.zip
Merge pull request #108 from alex/triple-des
[WIP] Add TripleDES
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 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))