diff options
author | Victor Shyba <victor1984@riseup.net> | 2016-11-27 02:25:07 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2016-12-12 09:17:51 -0200 |
commit | dc80d2b59edd14ab463dc74e5fa19d1a04c27ca1 (patch) | |
tree | f5b1c0e4bfe96438ca94aecab21ca607ffd073e1 /testing/tests | |
parent | b7bf30ca644775b38473571e47cbe102a5216d19 (diff) |
[refactor] introduces a GenericWriter
AESWriter and HMACWriter are just applying hmac or aes into a flow of
data. Abstracted the application of those operations into a super class
and highlighted just the difference on each implementation.
Diffstat (limited to 'testing/tests')
-rw-r--r-- | testing/tests/client/test_crypto.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/testing/tests/client/test_crypto.py b/testing/tests/client/test_crypto.py index 7643f75d..aad588c0 100644 --- a/testing/tests/client/test_crypto.py +++ b/testing/tests/client/test_crypto.py @@ -52,7 +52,7 @@ class AESTest(unittest.TestCase): key = 'A' * 32 fd = BytesIO() - aes = _crypto.AESConsumer(key, _buffer=fd) + aes = _crypto.AESWriter(key, _buffer=fd) iv = aes.iv data = snowden1 @@ -78,8 +78,7 @@ class AESTest(unittest.TestCase): ciphertext = _aes_encrypt(key, iv, data) fd = BytesIO() - operation = _crypto.AESConsumer.decrypt - aes = _crypto.AESConsumer(key, iv, fd, operation) + aes = _crypto.AESWriter(key, iv, fd, encrypt=False) for i in range(len(ciphertext) / block): chunk = ciphertext[i * block:(i + 1) * block] |