aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-06-13 17:02:58 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2014-06-13 17:02:58 -0400
commitfcef4976e326d310d0cf77a6a7b929313583e4ad (patch)
tree860ac3d385ef3f1d2ec8f9074ef810bf476e134f /tests
parent19b70d2adb5f7b9c1903d7b69e580b4c1148f394 (diff)
parentd1bac5e2a644b9072b9f0976110d5c929594b554 (diff)
downloadcryptography-fcef4976e326d310d0cf77a6a7b929313583e4ad.tar.gz
cryptography-fcef4976e326d310d0cf77a6a7b929313583e4ad.tar.bz2
cryptography-fcef4976e326d310d0cf77a6a7b929313583e4ad.zip
Merge pull request #1131 from reaperhulk/add-3des-ecb
Add TripleDES ECB
Diffstat (limited to 'tests')
-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(),
+ )