diff options
author | David Reid <dreid@dreid.org> | 2013-11-06 09:48:00 -0800 |
---|---|---|
committer | David Reid <dreid@dreid.org> | 2013-11-06 09:48:00 -0800 |
commit | 30eff66f48189671740f6f1a423454c68dcb9ae8 (patch) | |
tree | 5d8b58ac917d5cfcf9be209127a84de03ea942e1 /tests/hazmat/primitives/test_block.py | |
parent | e71121bd9756112f141d7f02bf734ba496c70472 (diff) | |
parent | dd0b51b92d9bafe6aaacc2565ace0c591a493965 (diff) | |
download | cryptography-30eff66f48189671740f6f1a423454c68dcb9ae8.tar.gz cryptography-30eff66f48189671740f6f1a423454c68dcb9ae8.tar.bz2 cryptography-30eff66f48189671740f6f1a423454c68dcb9ae8.zip |
Merge pull request #226 from reaperhulk/blockcipher-rename
Reorganize Block Cipher
Diffstat (limited to 'tests/hazmat/primitives/test_block.py')
-rw-r--r-- | tests/hazmat/primitives/test_block.py | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/tests/hazmat/primitives/test_block.py b/tests/hazmat/primitives/test_block.py index dd9c54c9..28f34478 100644 --- a/tests/hazmat/primitives/test_block.py +++ b/tests/hazmat/primitives/test_block.py @@ -19,35 +19,37 @@ import pytest from cryptography.exceptions import UnsupportedAlgorithm from cryptography.hazmat.primitives import interfaces -from cryptography.hazmat.primitives.block import BlockCipher, ciphers, modes +from cryptography.hazmat.primitives.ciphers import ( + Cipher, algorithms, modes +) -class TestBlockCipher(object): +class TestCipher(object): def test_instantiate_without_backend(self): - BlockCipher( - ciphers.AES(binascii.unhexlify(b"0" * 32)), + Cipher( + algorithms.AES(binascii.unhexlify(b"0" * 32)), modes.CBC(binascii.unhexlify(b"0" * 32)) ) def test_creates_encryptor(self): - cipher = BlockCipher( - ciphers.AES(binascii.unhexlify(b"0" * 32)), + cipher = Cipher( + algorithms.AES(binascii.unhexlify(b"0" * 32)), modes.CBC(binascii.unhexlify(b"0" * 32)) ) assert isinstance(cipher.encryptor(), interfaces.CipherContext) def test_creates_decryptor(self): - cipher = BlockCipher( - ciphers.AES(binascii.unhexlify(b"0" * 32)), + cipher = Cipher( + algorithms.AES(binascii.unhexlify(b"0" * 32)), modes.CBC(binascii.unhexlify(b"0" * 32)) ) assert isinstance(cipher.decryptor(), interfaces.CipherContext) -class TestBlockCipherContext(object): +class TestCipherContext(object): def test_use_after_finalize(self, backend): - cipher = BlockCipher( - ciphers.AES(binascii.unhexlify(b"0" * 32)), + cipher = Cipher( + algorithms.AES(binascii.unhexlify(b"0" * 32)), modes.CBC(binascii.unhexlify(b"0" * 32)), backend ) @@ -67,8 +69,8 @@ class TestBlockCipherContext(object): decryptor.finalize() def test_unaligned_block_encryption(self, backend): - cipher = BlockCipher( - ciphers.AES(binascii.unhexlify(b"0" * 32)), + cipher = Cipher( + algorithms.AES(binascii.unhexlify(b"0" * 32)), modes.ECB(), backend ) @@ -86,8 +88,8 @@ class TestBlockCipherContext(object): assert pt == b"a" * 80 decryptor.finalize() - def test_nonexistant_cipher(self, backend): - cipher = BlockCipher( + def test_nonexistent_cipher(self, backend): + cipher = Cipher( object(), object(), backend ) with pytest.raises(UnsupportedAlgorithm): |