diff options
author | Victor Shyba <victor1984@riseup.net> | 2016-11-27 02:25:07 -0300 |
---|---|---|
committer | Victor Shyba <victor1984@riseup.net> | 2016-11-28 13:47:30 -0300 |
commit | aecd9f068300fdf31a096b24385e163636d187f6 (patch) | |
tree | ac0e2b84e09371abd177e4548d35daf1a411aeb9 /testing | |
parent | f5dc54bc6ec07326156069f129ba7ddd64fd21cd (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')
-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] |