From dc42400cc91147b2574be2012ab8004e4f652bcc Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 21 Oct 2013 16:51:31 -0700 Subject: TripleDES OFB MMT tests --- tests/primitives/test_nist.py | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/primitives/test_nist.py b/tests/primitives/test_nist.py index 7244abab..99f5fc82 100644 --- a/tests/primitives/test_nist.py +++ b/tests/primitives/test_nist.py @@ -221,6 +221,20 @@ class TestTripleDES_CBC(object): ) test_MMT1 = generate_encrypt_test( + lambda path: load_nist_vectors_from_file(path, "ENCRYPT"), + os.path.join("3DES", "MMT"), + [ + "TCBCMMT1.rsp", + "TCBCMMT2.rsp", + "TCBCMMT3.rsp", + ], + lambda key1, key2, key3, iv: ( + ciphers.TripleDES(binascii.unhexlify(key1 + key2 + key3)) + ), + lambda key1, key2, key3, iv: modes.CBC(binascii.unhexlify(iv)), + ) + + test_MMT2 = generate_encrypt_test( lambda path: load_nist_vectors_from_file(path, "ENCRYPT"), os.path.join("3DES", "MMT"), [ @@ -236,13 +250,15 @@ class TestTripleDES_CBC(object): ), ) + +class TestTripleDES_OFB(object): test_MMT1 = generate_encrypt_test( lambda path: load_nist_vectors_from_file(path, "ENCRYPT"), os.path.join("3DES", "MMT"), [ - "TCBCMMT1.rsp", - "TCBCMMT2.rsp", - "TCBCMMT3.rsp", + "TOFBMMT1.rsp", + "TOFBMMT2.rsp", + "TOFBMMT3.rsp", ], lambda key1, key2, key3, iv: ( ciphers.TripleDES(binascii.unhexlify(key1 + key2 + key3)) @@ -250,9 +266,21 @@ class TestTripleDES_CBC(object): lambda key1, key2, key3, iv: modes.CBC(binascii.unhexlify(iv)), ) - -class TestTripleDES_OFB(object): - pass + test_MMT2 = generate_encrypt_test( + lambda path: load_nist_vectors_from_file(path, "ENCRYPT"), + os.path.join("3DES", "MMT"), + [ + "TOFBIMMT1.rsp", + "TOFBIMMT2.rsp", + "TOFBIMMT3.rsp", + ], + lambda key1, key2, key3, iv1, iv2, iv3: ( + ciphers.TripleDES(binascii.unhexlify(key1 + key2 + key3)) + ), + lambda key1, key2, key3, iv1, iv2, iv3: ( + modes.CBC(binascii.unhexlify(iv1 + iv2 + iv3)) + ), + ) class TestTripleDES_CFB(object): -- cgit v1.2.3