aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_3des.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat/primitives/test_3des.py')
-rw-r--r--tests/hazmat/primitives/test_3des.py37
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(),
+ )