aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-03-22 14:28:38 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-03-22 14:28:38 +0100
commit4d91bf449fb60138ae68c1efad96ea89af674f93 (patch)
treeba1220b21a0343a7f82486118a7824d99eb39428
parent8ca49e9ca87d4abd84b957ba7527ee5fef7ff0b1 (diff)
sysmoUSIM-GR1: Add basic (hacky) support for the sysmoUSIM-GR1
Right now we are only to program the KI, OPC, ICCID and IMSI. This is done in a direct way and through the card abstraction.
-rw-r--r--pySim/cards.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/pySim/cards.py b/pySim/cards.py
index 35cd046..fe8a6c9 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -318,5 +318,35 @@ class SysmoSIMgr1(GrcardSim):
name = 'sysmosim-gr1'
# In order for autodetection ...
+
+class SysmoUSIMgr1(Card):
+ """
+ sysmocom sysmoUSIM-GR1
+ """
+ name = 'sysmoUSIM-GR1'
+
+ @classmethod
+ def autodetect(kls, scc):
+ # TODO: Access the ATR
+ return None
+
+ def program(self, p):
+ # TODO: check if verify_chv could be used or what it needs
+ # self._scc.verify_chv(0x0A, [0x33,0x32,0x32,0x31,0x33,0x32,0x33,0x32])
+ # Unlock the card..
+ data, sw = self._scc._tp.send_apdu_checksw("0020000A083332323133323332")
+
+ # TODO: move into SimCardCommands
+ # TODO: Add OPC support support to pySIM
+ par = ( p['ki'] + # 16b K
+ 32*"F" + # 32b OPC
+ self._e_iccid(p['iccid']) + # 10b ICCID
+ self._e_imsi(p['imsi']) # 9b IMSI_len + id_type(9) + IMSI
+ )
+ data, sw = self._scc._tp.send_apdu_checksw("0099000033" + par)
+
+ def erase(self):
+ return
+
_cards_classes = [ FakeMagicSim, SuperSim, MagicSim, GrcardSim,
- SysmoSIMgr1 ]
+ SysmoSIMgr1, SysmoUSIMgr1 ]