aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]aes_keywrap.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/aes_keywrap.py b/aes_keywrap.py
index bb6968a..a026518 100644..100755
--- a/aes_keywrap.py
+++ b/aes_keywrap.py
@@ -144,8 +144,7 @@ if __name__ == "__main__":
K = AESKeyWrapWithPadding(self.hex2bin("00:01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f"))
C = K.wrap_key(I)
O = K.unwrap_key(C)
- if I != O:
- raise RuntimeError("Input and output plaintext did not match: {!r} <> {!r}".format(I, O))
+ self.assertEqual(I, O, "Input and output plaintext did not match: {!r} <> {!r}".format(I, O))
def rfc5649_test(self, K, Q, C):
K = AESKeyWrapWithPadding(key = self.hex2bin(K))
@@ -153,10 +152,8 @@ if __name__ == "__main__":
C = self.hex2bin(C)
c = K.wrap_key(Q)
q = K.unwrap_key(C)
- if q != Q:
- raise RuntimeError("Input and output plaintext did not match: {} <> {}".format(self.bin2hex(Q), self.bin2hex(q)))
- if c != C:
- raise RuntimeError("Input and output ciphertext did not match: {} <> {}".format(self.bin2hex(C), self.bin2hex(c)))
+ self.assertEqual(q, Q, "Input and output plaintext did not match: {} <> {}".format(self.bin2hex(Q), self.bin2hex(q)))
+ self.assertEqual(c, C, "Input and output ciphertext did not match: {} <> {}".format(self.bin2hex(C), self.bin2hex(c)))
def test_rfc5649_1(self):
self.rfc5649_test(K = "5840df6e29b02af1 ab493b705bf16ea1 ae8338f4dcc176a8",
@@ -213,4 +210,4 @@ if __name__ == "__main__":
def test_loopback_9(self):
self.loopback_test("Hello! My name is Inigo Montoya. You killed my AES key wrapper. Prepare to die.")
- unittest.main()
+ unittest.main(verbosity = 9)