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@D6420:~/pysim# root@D6420:~/pysim# ./pySim-read.py -p 0 Reading ... ICCID: 8988211000000073729 IMSI: 901700000007372 SMSP: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ACC: 0004 MSISDN: Not available Done !
root@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@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
On Wed, Nov 04, 2015 at 03:36:17PM +0100, Sipos Csaba wrote:
RuntimeError: SW match failed ! Expected 9000 and got 6a86.
According to ISO 7816-4, this 6a86 means 'incorrect P1 or P2 parameter'.
At this point I don't have any more ideas what to try, if anyone would have any suggestions I would apreciate it.
Please activate (or hack some code for) tracing the actual APDUs that pySim excahnges with the card. IIRC, pySim already has that option.
Once you see the raw APDUs, you can compare their encoding (particularly P1/P2) with those described in the relevant ETSI/3GPP (U)SIM specifications.