aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_block.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-11-06 12:22:09 +0800
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-11-06 12:22:09 +0800
commit21dde56b48bf473932ce815860dd2ec99f2e2c75 (patch)
tree3932669bfed4d6119b31723970684aad773d7d28 /tests/hazmat/primitives/test_block.py
parent1e636c3052a452792ec01349b99c7591ea29e9ed (diff)
downloadcryptography-21dde56b48bf473932ce815860dd2ec99f2e2c75.tar.gz
cryptography-21dde56b48bf473932ce815860dd2ec99f2e2c75.tar.bz2
cryptography-21dde56b48bf473932ce815860dd2ec99f2e2c75.zip
block cipher rename
* block renamed to ciphers * ciphers renamed to algorithms * base moved into algorithms
Diffstat (limited to 'tests/hazmat/primitives/test_block.py')
-rw-r--r--tests/hazmat/primitives/test_block.py32
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):