diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-13 12:29:37 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-13 12:29:37 -0500 |
commit | 8e717516a5f6c66e26b56a7b41f1a86bd0a5aa89 (patch) | |
tree | 694952278c10200937242631172bdc113445a4b2 /tests/hazmat/primitives | |
parent | 19b70d2adb5f7b9c1903d7b69e580b4c1148f394 (diff) | |
download | cryptography-8e717516a5f6c66e26b56a7b41f1a86bd0a5aa89.tar.gz cryptography-8e717516a5f6c66e26b56a7b41f1a86bd0a5aa89.tar.bz2 cryptography-8e717516a5f6c66e26b56a7b41f1a86bd0a5aa89.zip |
add TripleDES ECB support to OpenSSL backend
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r-- | tests/hazmat/primitives/test_3des.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_3des.py b/tests/hazmat/primitives/test_3des.py index b9354f0e..65660386 100644 --- a/tests/hazmat/primitives/test_3des.py +++ b/tests/hazmat/primitives/test_3des.py @@ -174,3 +174,40 @@ class TestTripleDESModeCFB8(object): ), lambda iv, **kwargs: modes.CFB8(binascii.unhexlify(iv)), ) + + +@pytest.mark.supported( + only_if=lambda backend: backend.cipher_supported( + algorithms.TripleDES("\x00" * 8), modes.ECB() + ), + skip_message="Does not support TripleDES ECB", +) +@pytest.mark.cipher +class TestTripleDESModeECB(object): + test_KAT = generate_encrypt_test( + load_nist_vectors, + os.path.join("ciphers", "3DES", "ECB"), + [ + "TECBinvperm.rsp", + "TECBpermop.rsp", + "TECBsubtab.rsp", + "TECBvarkey.rsp", + "TECBvartext.rsp", + ], + lambda keys, **kwargs: algorithms.TripleDES(binascii.unhexlify(keys)), + lambda **kwargs: modes.ECB(), + ) + + test_MMT = generate_encrypt_test( + load_nist_vectors, + os.path.join("ciphers", "3DES", "ECB"), + [ + "TECBMMT1.rsp", + "TECBMMT2.rsp", + "TECBMMT3.rsp", + ], + lambda key1, key2, key3, **kwargs: algorithms.TripleDES( + binascii.unhexlify(key1 + key2 + key3) + ), + lambda **kwargs: modes.ECB(), + ) |