aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2020-03-11 12:18:29 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2020-03-11 12:35:20 +0100
commitd9507865252057d298e5fff1b38cdebc5379289a (patch)
tree78bc93433d5e0c73d399d612ec47309173f74ac7
parentb3e11ea19625789041e75740ad42823923f0048f (diff)
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
-rw-r--r--pySim/cards.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/pySim/cards.py b/pySim/cards.py
index 0f84834..a872ee0 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