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
This commit is contained in:
Harald Welte
2024-05-10 19:55:02 +02:00
committed by laforge
parent 900b04559b
commit a644fecc01

View File

@@ -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]