aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_ciphers.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat/primitives/test_ciphers.py')
-rw-r--r--tests/hazmat/primitives/test_ciphers.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_ciphers.py b/tests/hazmat/primitives/test_ciphers.py
index dfafab3f..653f7ce6 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, CAST5
+ AES, Camellia, TripleDES, Blowfish, CAST5, ARC4
)
@@ -91,3 +91,22 @@ class TestCAST5(object):
def test_invalid_key_size(self):
with pytest.raises(ValueError):
CAST5(binascii.unhexlify(b"0" * 34))
+
+
+class TestARC4(object):
+ @pytest.mark.parametrize(("key", "keysize"), [
+ (b"0" * 10, 40),
+ (b"0" * 14, 56),
+ (b"0" * 16, 64),
+ (b"0" * 20, 80),
+ (b"0" * 32, 128),
+ (b"0" * 48, 192),
+ (b"0" * 64, 256),
+ ])
+ def test_key_size(self, key, keysize):
+ cipher = ARC4(binascii.unhexlify(key))
+ assert cipher.key_size == keysize
+
+ def test_invalid_key_size(self):
+ with pytest.raises(ValueError):
+ ARC4(binascii.unhexlify(b"0" * 34))