PySIM: SW match failed

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Sipos Csaba sipos.csaba at kvk.uni-obuda.hu
Wed Nov 4 14:36:17 UTC 2015


Dear Holger, Alexander, list

In the last couple of weeks we experiencing an issue programmin the SJS1 USIm cards with PySIM.

We can read them, but during programming, a lot of us got the following error:

root at D6420:~/pysim#
root at D6420:~/pysim# ./pySim-read.py -p 0
Reading ...
ICCID: 8988211000000073729
IMSI: 901700000007372
SMSP: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ACC: 0004
MSISDN: Not available
Done !

root at D6420:~/pysim# ./pySim-prog.py -p 0 -t sysmoUSIM-SJS1 -i 208920000000001 -s 8988211000000073729 -x 208 -y 92 --op=11111111111111111111111111111111 -k 8BAF473F2F8FD09487CCCBD7097C6862 -a 55127679
Insert card now (or CTRL-C to cancel)
Generated card parameters :
 > Name    : Magic
 > SMSP    : e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
 > ICCID   : 8988211000000073729
 > MCC/MNC : 208/92
 > IMSI    : 208920000000001
 > Ki      : 8BAF473F2F8FD09487CCCBD7097C6862
 > OPC     : 8e27b6af0e692e750f32667a3b14605d
 > ACC     : None

Programming ...
Traceback (most recent call last):
  File "./pySim-prog.py", line 626, in <module>
    card.program(cp)
  File "/root/pysim/pySim/cards.py", line 438, in program
    r = self._scc.select_file(['3f00'])
  File "/root/pysim/pySim/commands.py", line 44, in select_file
    data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4000002" + i)
  File "/root/pysim/pySim/transport/__init__.py", line 87, in send_apdu_checksw
    raise RuntimeError("SW match failed ! Expected %s and got %s." % (sw.lower(), rv[1]))
RuntimeError: SW match failed ! Expected 9000 and got 6a86.
root at D6420:~/pysim#

Please note that in this particular case I was trying to reprogram an SJS1 card with a card reader (and the exact command) that was worked in the past, and yet its not working now.

I don't think this is a PySIM error, but more likely a Pyscard or PCSC-lite problem. I tried several Pyscard versions (1.6.10, 1.6.12, 1.6.16. 1.7.0 and 1.9.0) and the it was all the same.

At this point I don't have any more ideas what to try, if anyone would have any suggestions I would apreciate it.

I am certainly not alone with this issue, several folks from OpenAIR and OpenLTE are also having the very same problem.

Regards,
Csaba



More information about the OpenBSC mailing list