dexter has uploaded this change for review.

View Change

pySim-shell: set default ADM key reference

ETSI TS 102 221, Table 9.3 specifies 0x0A as default key reference for
ADM1. Lets make sure pySim-shell uses this key-reference if the card is
a generic UICC.

Change-Id: I8a96244269dc6619f39a5369502b15b83740ee45
---
M pySim-shell.py
1 file changed, 10 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/77/28277/1
diff --git a/pySim-shell.py b/pySim-shell.py
index f498dea..e52c4ef 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -83,16 +83,26 @@
print("Card not readable!")
return None, None

+ generic_card = False
card = card_detect("auto", scc)
if card is None:
print("Warning: Could not detect card type - assuming a generic card type...")
card = SimCard(scc)
+ generic_card = True

profile = CardProfile.pick(scc)
if profile is None:
print("Unsupported card type!")
return None, card

+ # ETSI TS 102 221, Table 9.3 specifies a default for the PIN key
+ # references, however card manufactures may still decide to pick an
+ # arbitrary key reference. In case we run on a generic card class that is
+ # detected as an UICC, we will pick the key reference that is officially
+ # specified.
+ if generic_card and isinstance(profile, CardProfileUICC):
+ card._adm_chv_num = 0x0A
+
print("Info: Card is of type: %s" % str(profile))

# FIXME: This shouln't be here, the profile should add the applications,

To view, visit change 28277. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I8a96244269dc6619f39a5369502b15b83740ee45
Gerrit-Change-Number: 28277
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-MessageType: newchange