aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2013-08-10 15:22:28 -0400
committerDonald Stufft <donald@stufft.io>2013-08-10 15:22:28 -0400
commitea8e9fc0bd807c49318e12f6bbd2c2b43456feab (patch)
tree144a58d74e66925fcf4c9e88622aff2b70399524 /tests/primitives
parent6a37d27953f2d6075c6834eea46bb762ca523c22 (diff)
downloadcryptography-ea8e9fc0bd807c49318e12f6bbd2c2b43456feab.tar.gz
cryptography-ea8e9fc0bd807c49318e12f6bbd2c2b43456feab.tar.bz2
cryptography-ea8e9fc0bd807c49318e12f6bbd2c2b43456feab.zip
Remove the padding from the BlockCipher API
Diffstat (limited to 'tests/primitives')
-rw-r--r--tests/primitives/test_block.py10
-rw-r--r--tests/primitives/test_nist.py32
2 files changed, 21 insertions, 21 deletions
diff --git a/tests/primitives/test_block.py b/tests/primitives/test_block.py
index aa670be3..799e5f03 100644
--- a/tests/primitives/test_block.py
+++ b/tests/primitives/test_block.py
@@ -15,21 +15,21 @@ import binascii
import pytest
-from cryptography.primitives.block import BlockCipher, ciphers, modes, padding
+from cryptography.primitives.block import BlockCipher, ciphers, modes
class TestBlockCipher(object):
def test_cipher_name(self):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(b"0" * 32)),
- modes.CBC(binascii.unhexlify(b"0" * 32), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(b"0" * 32))
)
assert cipher.name == "AES-128-CBC"
def test_use_after_finalize(self):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(b"0" * 32)),
- modes.CBC(binascii.unhexlify(b"0" * 32), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(b"0" * 32))
)
cipher.encrypt(b"a" * 16)
cipher.finalize()
@@ -41,7 +41,7 @@ class TestBlockCipher(object):
def test_encrypt_with_invalid_operation(self):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(b"0" * 32)),
- modes.CBC(binascii.unhexlify(b"0" * 32), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(b"0" * 32))
)
cipher._operation = "decrypt"
@@ -51,7 +51,7 @@ class TestBlockCipher(object):
def test_finalize_with_invalid_operation(self):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(b"0" * 32)),
- modes.CBC(binascii.unhexlify(b"0" * 32), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(b"0" * 32))
)
cipher._operation = "wat"
diff --git a/tests/primitives/test_nist.py b/tests/primitives/test_nist.py
index 4452e936..8b63665c 100644
--- a/tests/primitives/test_nist.py
+++ b/tests/primitives/test_nist.py
@@ -19,7 +19,7 @@ import os
import pytest
-from cryptography.primitives.block import BlockCipher, ciphers, modes, padding
+from cryptography.primitives.block import BlockCipher, ciphers, modes
from ..utils import load_nist_vectors_from_file
@@ -49,7 +49,7 @@ class TestAES_CBC(object):
def test_KAT_GFSbox_128_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -59,7 +59,7 @@ class TestAES_CBC(object):
def test_KAT_GFSbox_192_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -69,7 +69,7 @@ class TestAES_CBC(object):
def test_KAT_GFSbox_256_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -79,7 +79,7 @@ class TestAES_CBC(object):
def test_KAT_KeySbox_128_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -89,7 +89,7 @@ class TestAES_CBC(object):
def test_KAT_KeySbox_192_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -99,7 +99,7 @@ class TestAES_CBC(object):
def test_KAT_KeySbox_256_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -109,7 +109,7 @@ class TestAES_CBC(object):
def test_KAT_VarKey_128_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -119,7 +119,7 @@ class TestAES_CBC(object):
def test_KAT_VarKey_192_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -129,7 +129,7 @@ class TestAES_CBC(object):
def test_KAT_VarKey_256_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -139,7 +139,7 @@ class TestAES_CBC(object):
def test_KAT_VarTxt_128_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -149,7 +149,7 @@ class TestAES_CBC(object):
def test_KAT_VarTxt_192_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -159,7 +159,7 @@ class TestAES_CBC(object):
def test_KAT_VarTxt_256_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -169,7 +169,7 @@ class TestAES_CBC(object):
def test_MMT_128_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -179,7 +179,7 @@ class TestAES_CBC(object):
def test_MMT_192_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()
@@ -189,7 +189,7 @@ class TestAES_CBC(object):
def test_MMT_256_encrypt(self, key, iv, plaintext, ciphertext):
cipher = BlockCipher(
ciphers.AES(binascii.unhexlify(key)),
- modes.CBC(binascii.unhexlify(iv), padding.NoPadding())
+ modes.CBC(binascii.unhexlify(iv)),
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()