From afc760d4e243a13b581434b38daa5417bcbe2273 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 15 Mar 2014 12:39:34 -0400 Subject: test IDEA key_size properly --- tests/hazmat/primitives/test_ciphers.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests/hazmat/primitives') diff --git a/tests/hazmat/primitives/test_ciphers.py b/tests/hazmat/primitives/test_ciphers.py index 50cadf64..d9f83535 100644 --- a/tests/hazmat/primitives/test_ciphers.py +++ b/tests/hazmat/primitives/test_ciphers.py @@ -18,7 +18,7 @@ import binascii import pytest from cryptography.hazmat.primitives.ciphers.algorithms import ( - AES, Camellia, TripleDES, Blowfish, ARC4, CAST5 + AES, Camellia, TripleDES, Blowfish, ARC4, CAST5, IDEA ) @@ -110,3 +110,13 @@ class TestARC4(object): def test_invalid_key_size(self): with pytest.raises(ValueError): ARC4(binascii.unhexlify(b"0" * 34)) + + +class TestIDEA(object): + def test_key_size(self): + cipher = IDEA(b"\x00" * 16) + assert cipher.key_size == 128 + + def test_invalid_key_size(self): + with pytest.raises(ValueError): + IDEA(b"\x00" * 17) -- cgit v1.2.3