global_platform: KCV support for PUT KEY

GlobalPlatform requires the use of the KCV for DES + AES keys. Let's
implement that.

(11.8.2.3.3: "For all key types described in section B.6, the Key Check
Value shall be present.")

Change-Id: Ief168a66dee58b56f4126db12829b3a98906c8db
This commit is contained in:
Harald Welte
2024-02-04 15:38:12 +01:00
parent e55fcf66bf
commit cd8e16fdfe
2 changed files with 40 additions and 1 deletions

View File

@@ -214,6 +214,12 @@ class SCP03_Test_AES256_33(SCP03_Test, unittest.TestCase):
# FIXME: test auth with random (0x60) vs pseudo-random (0x70) challenge
class SCP03_KCV_Test(unittest.TestCase):
def test_kcv(self):
self.assertEqual(compute_kcv('aes', KEYSET_AES128.enc), h2b('C35280'))
self.assertEqual(compute_kcv('aes', KEYSET_AES128.mac), h2b('013808'))
self.assertEqual(compute_kcv('aes', KEYSET_AES128.dek), h2b('840DE5'))
if __name__ == "__main__":
unittest.main()