diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-10-19 14:12:04 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-10-21 08:50:05 -0500 |
commit | 620c2aec10423c11e49cbffc71efe19a190f9187 (patch) | |
tree | d8b3abaf1a64b720ab5410087f82309c1bb43c22 /tests/primitives/utils.py | |
parent | e58820924094b8846bf739c2eb66f049a9a75939 (diff) | |
download | cryptography-620c2aec10423c11e49cbffc71efe19a190f9187.tar.gz cryptography-620c2aec10423c11e49cbffc71efe19a190f9187.tar.bz2 cryptography-620c2aec10423c11e49cbffc71efe19a190f9187.zip |
block cipher decryption support
This is a squash of previous commits plus new ones. Ran into a pile of
conflicts during the rebase and decided this was an easier way to retain
a sane commit history
Diffstat (limited to 'tests/primitives/utils.py')
-rw-r--r-- | tests/primitives/utils.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/primitives/utils.py b/tests/primitives/utils.py index a3759b03..70ece52a 100644 --- a/tests/primitives/utils.py +++ b/tests/primitives/utils.py @@ -37,9 +37,14 @@ def encrypt_test(api, cipher_factory, mode_factory, params, only_if, mode_factory(**params), api ) - actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext)) - actual_ciphertext += cipher.finalize() + encryptor = cipher.encryptor() + actual_ciphertext = encryptor.update(binascii.unhexlify(plaintext)) + actual_ciphertext += encryptor.finalize() assert actual_ciphertext == binascii.unhexlify(ciphertext) + decryptor = cipher.decryptor() + actual_plaintext = decryptor.update(binascii.unhexlify(ciphertext)) + actual_plaintext += decryptor.finalize() + assert actual_plaintext == binascii.unhexlify(plaintext) def generate_hash_test(param_loader, path, file_names, hash_cls, |