diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-03-16 08:07:55 -0430 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-03-16 08:07:55 -0430 |
commit | 1e7ce06edb9179cf2afc66b031767d9246242fad (patch) | |
tree | 73bf237fc89851950325a78c1ded24f8343cb4b1 /tests/hazmat/primitives/test_ciphers.py | |
parent | 77fdd4e4559c30ee0155430f6fe192311b5eae8b (diff) | |
parent | 471c1184eb8a7c24111abdc0bcb418c6c6839757 (diff) | |
download | cryptography-1e7ce06edb9179cf2afc66b031767d9246242fad.tar.gz cryptography-1e7ce06edb9179cf2afc66b031767d9246242fad.tar.bz2 cryptography-1e7ce06edb9179cf2afc66b031767d9246242fad.zip |
Merge pull request #806 from Ayrx/add-backend-check-to-cipher
Added backend check to cipher primitives
Diffstat (limited to 'tests/hazmat/primitives/test_ciphers.py')
-rw-r--r-- | tests/hazmat/primitives/test_ciphers.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_ciphers.py b/tests/hazmat/primitives/test_ciphers.py index d9f83535..e1f5dbc3 100644 --- a/tests/hazmat/primitives/test_ciphers.py +++ b/tests/hazmat/primitives/test_ciphers.py @@ -17,10 +17,15 @@ import binascii import pytest +from cryptography.exceptions import UnsupportedInterface + +from cryptography.hazmat.primitives import ciphers from cryptography.hazmat.primitives.ciphers.algorithms import ( AES, Camellia, TripleDES, Blowfish, ARC4, CAST5, IDEA ) +from cryptography.hazmat.primitives.ciphers.modes import ECB + class TestAES(object): @pytest.mark.parametrize(("key", "keysize"), [ @@ -120,3 +125,10 @@ class TestIDEA(object): def test_invalid_key_size(self): with pytest.raises(ValueError): IDEA(b"\x00" * 17) + + +def test_invalid_backend(): + pretend_backend = object() + + with pytest.raises(UnsupportedInterface): + ciphers.Cipher(AES(b"AAAAAAAAAAAAAAAA"), ECB, pretend_backend) |