diff options
author | David Reid <dreid@dreid.org> | 2013-10-22 11:06:11 -0700 |
---|---|---|
committer | David Reid <dreid@dreid.org> | 2013-10-22 11:06:11 -0700 |
commit | 9949702886c815277bb7483b1a0d429a2a7ffd7c (patch) | |
tree | 3c2c586cee0c5d5ea416f891fa9ec337650296ed /tests/primitives/utils.py | |
parent | ab73ed9a6fadd69c7d394617fac6d6d2ab818abf (diff) | |
parent | b2c94fd22e0da4159be8c98dd32917bdf9cfb504 (diff) | |
download | cryptography-9949702886c815277bb7483b1a0d429a2a7ffd7c.tar.gz cryptography-9949702886c815277bb7483b1a0d429a2a7ffd7c.tar.bz2 cryptography-9949702886c815277bb7483b1a0d429a2a7ffd7c.zip |
Merge pull request #112 from reaperhulk/block-cipher-decrypt
Block Cipher Decryption
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 a15e773c..91ca36d8 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, |