diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-16 16:57:20 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-16 16:57:20 -0700 |
commit | 6abac461b39ad64bdee409af84808df77f73dc24 (patch) | |
tree | b65bfb3fd419110d1440e8d8d0c9aa6de296bd25 /tests | |
parent | e761f8b33519104605b14cf8a24e9f68bd23b624 (diff) | |
download | cryptography-6abac461b39ad64bdee409af84808df77f73dc24.tar.gz cryptography-6abac461b39ad64bdee409af84808df77f73dc24.tar.bz2 cryptography-6abac461b39ad64bdee409af84808df77f73dc24.zip |
Port this test except it doesn't work because of plaintext and ciphertext naming, need to make that flexible
Diffstat (limited to 'tests')
-rw-r--r-- | tests/primitives/test_nist.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/primitives/test_nist.py b/tests/primitives/test_nist.py index ceecd57e..1c23fca0 100644 --- a/tests/primitives/test_nist.py +++ b/tests/primitives/test_nist.py @@ -194,21 +194,15 @@ class TestTripleDES_CBC(object): lambda keys, iv1, iv2, iv3: modes.CBC(iv1 + iv2 + iv3), ) - @parameterize_encrypt_test( - "3DES", "KAT", - ("keys", "iv1", "iv2", "iv3", "plaintext1", "ciphertext3"), + test_KAT3 = generate_encrypt_test( + lambda path: load_nist_vectors_from_file(path, "ENCRYPT"), + os.path.join("3DES", "KAT"), [ "TCBCIinvperm.rsp", - ] + ], + lambda keys, iv1, iv2, iv3: ciphers.TripleDES(binascii.unhexlify(keys)), + lambda keys, iv1, iv2, iv3: modes.CBC(iv1 + iv2 + iv3), ) - def test_KAT_3(self, keys, iv1, iv2, iv3, plaintext1, ciphertext3): - cipher = BlockCipher( - ciphers.TripleDES(binascii.unhexlify(keys)), - modes.CBC(binascii.unhexlify(iv1 + iv2 + iv3)), - ) - actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext1)) - actual_ciphertext += cipher.finalize() - assert binascii.hexlify(actual_ciphertext) == ciphertext3 test_MMT1 = generate_encrypt_test( lambda path: load_nist_vectors_from_file(path, "ENCRYPT"), |