Reading sim failed

I’m new to this topic and could use some guidance.

I’m working with an MCR3512v2.0 SIM card reader connected to a PC running Ubuntu 24.1. I’ve installed Osmocom tools within a Python virtual environment. My goal is to read SIM card information using the following command:

./pySim-read.py -p0

This works perfectly with commercial SIM cards. However, when I try it with a programmable SIM card, it fails.

Interestingly, I’ve tested the programmable SIM card with another SIM reading tool, and it works fine there—so the card itself seems functional.

Could anyone help me troubleshoot this? Below is the error message I’m encountering:
(pysim) ue@:~/pysim$ ./pySim-read.py -p0
Using reader PCSC[Identiv SCR35xx USB Smart Card Reader [CCID Interface] (35122023061912) 00 00]
Reading …
Autodetection failed
Traceback (most recent call last):
File “/home/ctl-oai-ue/pysim/./pySim-read.py”, line 107, in
(res, sw) = card.read_iccid()
^^^^^^^^^^^^^^^^^
File “/home/ctl-oai-ue/pysim/pySim/legacy/cards.py”, line 61, in read_iccid
(res, sw) = self._scc.read_binary(EF[‘ICCID’])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/ctl-oai-ue/pysim/pySim/commands.py”, line 305, in read_binary
r = self.select_path(ef)
^^^^^^^^^^^^^^^^^^^^
File “/home/ctl-oai-ue/pysim/pySim/commands.py”, line 270, in select_path
data, _sw = self.select_file(i)
^^^^^^^^^^^^^^^^^^^
File “/home/ctl-oai-ue/pysim/pySim/commands.py”, line 281, in select_file
return self.send_apdu_checksw(self.cla_byte + “a4” + self.sel_ctrl + “02” + fid + “00”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/ctl-oai-ue/pysim/pySim/commands.py”, line 126, in send_apdu_checksw
return self._tp.send_apdu_checksw(pdu, sw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/ctl-oai-ue/pysim/pySim/transport/init.py”, line 244, in send_apdu_checksw
raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter)
pySim.exceptions.SwMatchError: SW match failed! Expected 9000 and got 6e00.

When saying commercial you mean a SIM card issued by a public cellular operator? I’m asking as the programmable cards your refer-to below are equally commercial as they are commercially sold.

Sadly you did not explain to us which card model you were trying to use. In general, pySim only reliably supports only those programmable cards where the vendor (or in absence of the vendor, some users) contribute related support. It seems that your card may not be a valid ETSI UICC compliant with related standards at the time you use it with pySim-shell, as the EF.ICCID is not selectable.

Your assumptions in the reply is absolutely correct. Thank you:
I bought osmocom sims and it works well.
Regards

1 Like