Hi Team,
I am getting the following error while running the pySim-read.py , This program runs fine on old SIM cards but in new SIM cards it gives the below error.
I did a comparison of directories on both the SIM cards and there is a difference, Kindly guide how to fix it . Although EF.ICCID exists in both the SIM cards .
Additionally pySim-shell.py works well .
python3 pySim-read.py -p 1 Using reader PCSC[HID Global OMNIKEY 3x21 Smart Card Reader [OMNIKEY 3x21 Smart Card Reader] 01 00] Reading ... Autodetection failed Traceback (most recent call last): File "/home/lab3/pysim/pySim-read.py", line 105, in <module> (res, sw) = card.read_iccid() File "/home/lab3/pysim/pySim/legacy/cards.py", line 62, in read_iccid (res, sw) = self._scc.read_binary(EF['ICCID']) File "/home/lab3/pysim/pySim/commands.py", line 320, in read_binary r = self.select_path(ef) File "/home/lab3/pysim/pySim/commands.py", line 285, in select_path data, _sw = self.select_file(i) File "/home/lab3/pysim/pySim/commands.py", line 296, in select_file return self.send_apdu_checksw(self.cla_byte + "a4" + self.sel_ctrl + "02" + fid) File "/home/lab3/pysim/pySim/commands.py", line 143, in send_apdu_checksw return self._tp.send_apdu_checksw(pdu, sw) File "/home/lab3/pysim/pySim/transport/__init__.py", line 218, in send_apdu_checksw raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter) pySim.exceptions.SwMatchError: SW match failed! Expected 9000 and got 6e00.
BR// Niraj Kumar
Hi Team,
I dig it further for more information and the reason I can understand may be that post getting SW as 6e00 it runs the classical SIM procedure since its a USIM hence the further procedure gets failed .
I captured the packets between the SIM and card reader by SIMTRACE, In successful case it show the packets but in unsuccessful case it shows as packet malformed ,
Packets captured which successful SIM card.
[image: Screenshot from 2024-07-11 18-03-00.png]
I am attaching the output of the "tree" command from both the SIM cards , Which I login via the pySim-shell.py program .
Could it be a case that APDU response from problematic SIM cards is protected ?
On Wed, Jul 10, 2024 at 2:58 PM Neeraj Chaudhary chaudhary.neer@gmail.com wrote:
Hi Team,
I am getting the following error while running the pySim-read.py , This program runs fine on old SIM cards but in new SIM cards it gives the below error.
I did a comparison of directories on both the SIM cards and there is a difference, Kindly guide how to fix it . Although EF.ICCID exists in both the SIM cards .
Additionally pySim-shell.py works well .
python3 pySim-read.py -p 1 Using reader PCSC[HID Global OMNIKEY 3x21 Smart Card Reader [OMNIKEY 3x21 Smart Card Reader] 01 00] Reading ... Autodetection failed Traceback (most recent call last): File "/home/lab3/pysim/pySim-read.py", line 105, in <module> (res, sw) = card.read_iccid() File "/home/lab3/pysim/pySim/legacy/cards.py", line 62, in read_iccid (res, sw) = self._scc.read_binary(EF['ICCID']) File "/home/lab3/pysim/pySim/commands.py", line 320, in read_binary r = self.select_path(ef) File "/home/lab3/pysim/pySim/commands.py", line 285, in select_path data, _sw = self.select_file(i) File "/home/lab3/pysim/pySim/commands.py", line 296, in select_file return self.send_apdu_checksw(self.cla_byte + "a4" + self.sel_ctrl + "02" + fid) File "/home/lab3/pysim/pySim/commands.py", line 143, in send_apdu_checksw return self._tp.send_apdu_checksw(pdu, sw) File "/home/lab3/pysim/pySim/transport/__init__.py", line 218, in send_apdu_checksw raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter) pySim.exceptions.SwMatchError: SW match failed! Expected 9000 and got 6e00.
BR// Niraj Kumar
Hi Team,
Just checking if there are any views on it please ?
BR// Niraj Kumar
On Thu, Jul 11, 2024 at 6:06 PM Neeraj Chaudhary chaudhary.neer@gmail.com wrote:
Hi Team,
I dig it further for more information and the reason I can understand may be that post getting SW as 6e00 it runs the classical SIM procedure since its a USIM hence the further procedure gets failed .
I captured the packets between the SIM and card reader by SIMTRACE, In successful case it show the packets but in unsuccessful case it shows as packet malformed ,
Packets captured which successful SIM card.
[image: Screenshot from 2024-07-11 18-03-00.png]
I am attaching the output of the "tree" command from both the SIM cards , Which I login via the pySim-shell.py program .
Could it be a case that APDU response from problematic SIM cards is protected ?
On Wed, Jul 10, 2024 at 2:58 PM Neeraj Chaudhary chaudhary.neer@gmail.com wrote:
Hi Team,
I am getting the following error while running the pySim-read.py , This program runs fine on old SIM cards but in new SIM cards it gives the below error.
I did a comparison of directories on both the SIM cards and there is a difference, Kindly guide how to fix it . Although EF.ICCID exists in both the SIM cards .
Additionally pySim-shell.py works well .
python3 pySim-read.py -p 1 Using reader PCSC[HID Global OMNIKEY 3x21 Smart Card Reader [OMNIKEY 3x21 Smart Card Reader] 01 00] Reading ... Autodetection failed Traceback (most recent call last): File "/home/lab3/pysim/pySim-read.py", line 105, in <module> (res, sw) = card.read_iccid() File "/home/lab3/pysim/pySim/legacy/cards.py", line 62, in read_iccid (res, sw) = self._scc.read_binary(EF['ICCID']) File "/home/lab3/pysim/pySim/commands.py", line 320, in read_binary r = self.select_path(ef) File "/home/lab3/pysim/pySim/commands.py", line 285, in select_path data, _sw = self.select_file(i) File "/home/lab3/pysim/pySim/commands.py", line 296, in select_file return self.send_apdu_checksw(self.cla_byte + "a4" + self.sel_ctrl + "02" + fid) File "/home/lab3/pysim/pySim/commands.py", line 143, in send_apdu_checksw return self._tp.send_apdu_checksw(pdu, sw) File "/home/lab3/pysim/pySim/transport/__init__.py", line 218, in send_apdu_checksw raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter) pySim.exceptions.SwMatchError: SW match failed! Expected 9000 and got 6e00.
BR// Niraj Kumar