aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/test_python.py
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-04-19 07:20:22 -0400
committerJack Lloyd <[email protected]>2019-04-19 12:05:33 -0400
commit9cb410bf050b56726dbe2f69c43c373a9a3ddf04 (patch)
tree21e8cebecef303ba3f760c7803fd8ab0f92588dd /src/scripts/test_python.py
parente21bddd79357f2ad8576fd871d387b722192b847 (diff)
Add support for NIST key wrap in Python
Diffstat (limited to 'src/scripts/test_python.py')
-rw-r--r--src/scripts/test_python.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/scripts/test_python.py b/src/scripts/test_python.py
index b6e8ca9d6..286b29edd 100644
--- a/src/scripts/test_python.py
+++ b/src/scripts/test_python.py
@@ -397,6 +397,17 @@ ofvkP1EDmpx50fHLawIDAQAB
self.assertEqual(value, ptext)
+ def test_keywrap(self):
+ key = hex_decode('00112233445566778899aabbccddeeff')
+ kek = hex_decode('000102030405060708090a0b0c0d0e0f')
+
+ wrapped = botan2.nist_key_wrap(kek, key)
+ self.assertEqual(hex_encode(wrapped), '1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5')
+
+ self.assertEqual(len(wrapped), 16+8)
+ unwrapped = botan2.nist_key_unwrap(kek, wrapped)
+ self.assertEqual(hex_encode(unwrapped), '00112233445566778899aabbccddeeff')
+
def test_hotp(self):
hotp = botan2.HOTP(b'12345678901234567890')