From a644fecc01af11534d65704e1cc302f47f18fc36 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 10 May 2024 19:55:02 +0200 Subject: [PATCH] pySim.global_platform: Fix key encryption with DEK When a SCP is active, the DEK is used to encrypt any key material that's installed using PUT KEY. The code prior to this patch fails to handle this case as it calls the encrypt_key() method on the wrong object. Change-Id: I6e10fb9c7881ba74ad2986c36bba95b336470838 --- pySim/global_platform/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySim/global_platform/__init__.py b/pySim/global_platform/__init__.py index 9960560d..5086721f 100644 --- a/pySim/global_platform/__init__.py +++ b/pySim/global_platform/__init__.py @@ -550,7 +550,7 @@ class ADF_SD(CardADF): kcv = b2h(kcv_bin) if self._cmd.lchan.scc.scp: # encrypte key data with DEK of current SCP - kcb = b2h(self._cmd.lchan.scc.scp.card_keys.encrypt_key(h2b(opts.key_data[i]))) + kcb = b2h(self._cmd.lchan.scc.scp.encrypt_key(h2b(opts.key_data[i]))) else: # (for example) during personalization, DEK might not be required) kcb = opts.key_data[i]