From d9507865252057d298e5fff1b38cdebc5379289a Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 11 Mar 2020 12:18:29 +0100 Subject: [PATCH] sysmoISIM-SJA2: Add suport for USIM-only and ISIM-only cards When pysim-prog programms the application specific files of ISIM and USIM it selects the application by its AID first. If depending on the card profile one of the applications is missing the selection of the related ADF will fail. Lets check the presence of the AID first and if it is not present lets skip the programming of the related files. Change-Id: I0eec6ed244320fcd4dc410b6fab20df9c64ff906 Related: SYS#4817 --- pySim/cards.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pySim/cards.py b/pySim/cards.py index 0f848345..a872ee07 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -1054,20 +1054,22 @@ class SysmoISIMSJA2(Card): # update EF-USIM_AUTH_KEY in ADF.ISIM self._scc.select_file(['3f00']) aid = self.read_aid(isim = True) - self._scc.select_adf(aid) - if p.get('ki'): - self._scc.update_binary('af20', p['ki'], 1) - if p.get('opc'): - self._scc.update_binary('af20', p['opc'], 17) + if (aid): + self._scc.select_adf(aid) + if p.get('ki'): + self._scc.update_binary('af20', p['ki'], 1) + if p.get('opc'): + self._scc.update_binary('af20', p['opc'], 17) # update EF-USIM_AUTH_KEY in ADF.USIM self._scc.select_file(['3f00']) aid = self.read_aid() - self._scc.select_adf(aid) - if p.get('ki'): - self._scc.update_binary('af20', p['ki'], 1) - if p.get('opc'): - self._scc.update_binary('af20', p['opc'], 17) + if (aid): + self._scc.select_adf(aid) + if p.get('ki'): + self._scc.update_binary('af20', p['ki'], 1) + if p.get('opc'): + self._scc.update_binary('af20', p['opc'], 17) return