aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_block.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-10-21 14:44:42 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-10-21 14:44:42 -0700
commit6f874ff9279376b6962c514ae0e59b90e7082e15 (patch)
treedcbc2e2491bffc6ad19eea41bbeeba85d65a48b3 /tests/primitives/test_block.py
parentd6644815913e878462aa51c95c84e6d871406e27 (diff)
parent71ed449ffe7e26e9217b6c44bb27e19996315a64 (diff)
downloadcryptography-6f874ff9279376b6962c514ae0e59b90e7082e15.tar.gz
cryptography-6f874ff9279376b6962c514ae0e59b90e7082e15.tar.bz2
cryptography-6f874ff9279376b6962c514ae0e59b90e7082e15.zip
Merge branch 'master' into refactor-cipher-names
Conflicts: cryptography/bindings/openssl/api.py
Diffstat (limited to 'tests/primitives/test_block.py')
-rw-r--r--tests/primitives/test_block.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/primitives/test_block.py b/tests/primitives/test_block.py
index 774885fa..9f5905bf 100644
--- a/tests/primitives/test_block.py
+++ b/tests/primitives/test_block.py
@@ -23,20 +23,11 @@ from cryptography.primitives.block.base import _Operation
class TestBlockCipher(object):
- def test_cipher_name(self, api):
- cipher = BlockCipher(
- ciphers.AES(binascii.unhexlify(b"0" * 32)),
- modes.CBC(binascii.unhexlify(b"0" * 32)),
- api
- )
- assert cipher.name == "AES-128-CBC"
-
def test_instantiate_without_api(self):
- cipher = BlockCipher(
+ BlockCipher(
ciphers.AES(binascii.unhexlify(b"0" * 32)),
modes.CBC(binascii.unhexlify(b"0" * 32))
)
- assert cipher.name == "AES-128-CBC"
def test_use_after_finalize(self, api):
cipher = BlockCipher(
@@ -72,3 +63,14 @@ class TestBlockCipher(object):
with pytest.raises(ValueError):
cipher.finalize()
+
+ def test_unaligned_block_encryption(self, api):
+ cipher = BlockCipher(
+ ciphers.AES(binascii.unhexlify(b"0" * 32)),
+ modes.ECB(),
+ api
+ )
+ ct = cipher.encrypt(b"a" * 15)
+ assert ct == b""
+ ct += cipher.encrypt(b"a" * 65)
+ assert len(ct) == 80