From 6cfcc1ec5bc0e2c944ec66bd62d58740d2b8823d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Tue, 11 Sep 2018 12:37:28 +0200 Subject: Adding a huge, self testing test case. --- src/model/aes_keywrap.py | 83 ++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 38 deletions(-) (limited to 'src/model/aes_keywrap.py') diff --git a/src/model/aes_keywrap.py b/src/model/aes_keywrap.py index 0e74ed8..d8b57fe 100755 --- a/src/model/aes_keywrap.py +++ b/src/model/aes_keywrap.py @@ -281,25 +281,25 @@ if __name__ == "__main__": # Test vectors from NISTs set of test vectors for SP800-38F KWP algorithm. # 128 bit key. -# def test_kwp_ae_128_1(self): -# self.rfc5649_test(K = "7efb9b3964de316e 7245c86186d98b5f", -# Q = "3e", -# C = "116a4054c13b7fea de9c22aa57b3caed") -# -# def test_kwp_ae_128_2(self): -# self.rfc5649_test(K = "45c770fc26717507 2d70a38269c54685", -# Q = "cc5fb15a17795c34", -# C = "78ffa3f03b65c55b 812f355730af71ac") -# -# def test_kwp_ae_128_3(self): -# self.rfc5649_test(K = "853e2bac0f1e6298 67acea0d2b3c087e", -# Q = "49575527bc59530f be", -# C = "b43781062eb0317e b2dec6329f2d64de 1c33d85570d57db6") - -# def test_kwp_ae_128_4(self): -# self.rfc5649_test(K = "c03db3cc1416dcd1 c069a195a8d77e3d", -# Q = "46f87f58cdda4200 f53d99ce2e49bdb7 6212511fe0cd4d0 b5f37a27d45a288", -# C = "57e3b6699c6e8177 59a69492bb7e2cd0 0160d2ebef9bf4d 4eb16fbf798f134 0f6df6558a4fb84cd0") + def test_kwp_ae_128_1(self): + self.rfc5649_test(K = "7efb9b3964de316e 7245c86186d98b5f", + Q = "3e", + C = "116a4054c13b7fea de9c22aa57b3caed") + + def test_kwp_ae_128_2(self): + self.rfc5649_test(K = "45c770fc26717507 2d70a38269c54685", + Q = "cc5fb15a17795c34", + C = "78ffa3f03b65c55b 812f355730af71ac") + + def test_kwp_ae_128_3(self): + self.rfc5649_test(K = "853e2bac0f1e6298 67acea0d2b3c087e", + Q = "49575527bc59530f be", + C = "b43781062eb0317e b2dec6329f2d64de 1c33d85570d57db6") + + def test_kwp_ae_128_4(self): + self.rfc5649_test(K = "c03db3cc1416dcd1 c069a195a8d77e3d", + Q = "46f87f58cdda4200 f53d99ce2e49bdb7 6212511fe0cd4d0 b5f37a27d45a288", + C = "57e3b6699c6e8177 59a69492bb7e2cd0 0160d2ebef9bf4d 4eb16fbf798f134 0f6df6558a4fb84cd0") def test_kwp_ae_128_5(self): self.rfc5649_test(K = "6b8ba9cc9b31068b a175abfcc60c1338", @@ -309,25 +309,32 @@ if __name__ == "__main__": C = "aea19443d7f8ad7d 4501c1ecadc6b5e3 f1c23c29eca60890 5f9cabdd46e34a55 e1f7ac8308e75c90 3675982bda99173a 2ba57d2ccf2e01a0 2589f89dfd4b3c7f d229ec91c9d0c46e a5dee3c048cd4611 bfeadc9bf26daa1e 02cb72e222cf3dab 120dd1e8c2dd9bd5 8bbefa5d14526abd 1e8d2170a6ba8283 c243ec2fd5ef0703 0b1ef5f69f9620e4 b17a363934100588 7b9ffc7935335947 03e5dcae67bd0ce7 a3c98ca65815a4d0 67f27e6e66d6636c ebb789732566a52a c3970e14c37310dc 2fcee0e739a16291 029fd2b4d534e304 45474b26711a8b3e 1ee3cc88b09e8b17 45b6cc0f067624ec b232db750b01fe54 57fdea77b251b10f e95d3eeedb083bdf 109c41dba26cc965 4f787bf95735ff07 070b175cea8b6230 2e6087b91a041547 4605691099f1a9e2 b626c4b3bb7aeb8e ad9922bc3617cb42 7c669b88be5f98ae a7edb8b0063bec80 af4c081f89778d7c 7242ddae88e8d3af f1f80e575e1aab4a 5d115bc27636fd14 d19bc59433f69763 5ecd870d17e7f5b0 04dee4001cddc34a b6e377eeb3fb08e9 476970765105d93e 4558fe3d4fc6fe05 3aab9c6cf032f111 6e70c2d65f7c8cde b6ad63ac4291f93d 467ebbb29ead265c 05ac684d20a6bef0 9b71830f717e08bc b4f9d3773bec928f 66eeb64dc451e958 e357ebbfef5a342d f28707ac4b8e3e8c 854e8d691cb92e87 c0d57558e44cd754 424865c229c9e1ab b28e003b6819400b") -# def test_kwp_ae_256_1(self): -# self.rfc5649_test(K = "2800f18237cf8d2b a1dfe361784fd751 9b0fdb0ec73e2ab1 c0b966b9173fc5b5", -# Q = "ad", -# C = "c1eccf2d077a385e 67aaeb35552c893c") -# -# def test_kwp_ae_256_2(self): -# self.rfc5649_test(K = "1c997c2bb5a15a45 93e337b3249675d55 7467417917f6bc51 65c9af6a3e29504", -# Q = "3e3eafc50cd4e939", -# C = "163eb9e7dbc8ed00 86dffbc6ab00e329") -# -# def test_kwp_ae_256_3(self): -# self.rfc5649_test(K = "8df1533f99be6fe6 0f951057fed1daccd 14bd4e34118f24af 677bbf46bf11fe7", -# Q = "fb36b1f3907fb5ed ce", -# C = "6974d7bae0221b4e d91336c26af77e327 61f6024d8bbf292") -# -# def test_kwp_ae_256_4(self): -# self.rfc5649_test(K = "dea4667d911b5c9e c996cdb35da0e29bc 996cbfb0e0a56bac 12fccc334d732eb", -# Q = "25d58d437a56a733 2a18541333201f992 9fccde11b06844c1 9ba1ca224cfd6", -# C = "86d4e258391f15d7 d4f0ab3e15d6f45e6 5dd2f8caf4c67209 63bb8970fc2f3a4 a58dc74674347ec9") + def test_kwp_ae_256_1(self): + self.rfc5649_test(K = "2800f18237cf8d2b a1dfe361784fd751 9b0fdb0ec73e2ab1 c0b966b9173fc5b5", + Q = "ad", + C = "c1eccf2d077a385e 67aaeb35552c893c") + + def test_kwp_ae_256_2(self): + self.rfc5649_test(K = "1c997c2bb5a15a45 93e337b3249675d55 7467417917f6bc51 65c9af6a3e29504", + Q = "3e3eafc50cd4e939", + C = "163eb9e7dbc8ed00 86dffbc6ab00e329") + + def test_kwp_ae_256_3(self): + self.rfc5649_test(K = "8df1533f99be6fe6 0f951057fed1daccd 14bd4e34118f24af 677bbf46bf11fe7", + Q = "fb36b1f3907fb5ed ce", + C = "6974d7bae0221b4e d91336c26af77e327 61f6024d8bbf292") + + def test_kwp_ae_256_4(self): + self.rfc5649_test(K = "dea4667d911b5c9e c996cdb35da0e29bc 996cbfb0e0a56bac 12fccc334d732eb", + Q = "25d58d437a56a733 2a18541333201f992 9fccde11b06844c1 9ba1ca224cfd6", + C = "86d4e258391f15d7 d4f0ab3e15d6f45e6 5dd2f8caf4c67209 63bb8970fc2f3a4 a58dc74674347ec9") + + +# # Huge test case. It fails since the expected wrapped object is wrong. +# def test_huge_256_1(self): +# self.rfc5649_test(K = "55aa55aa55aa55aa" * 4, +# Q = "0101010101010101" * 2040, +# C = "86d4e258391f15d7" * 2042) # def test_loopback_1(self): -- cgit v1.2.3