pySIM patch for USIM

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/.

Dragos Vingarzan Dragos.Vingarzan at fokus.fraunhofer.de
Tue May 22 16:51:50 UTC 2012


Hello Silvain,

please find attached a patch for pySIM which I put together today after
some work to get the extra parameters which I needed on the
sysmoUSIM-GR1. Don't know if it only works for those cards.

This fixes some bugs in setting the IMSI and also adds support for
selecting USIM and writing binary/records in there. I have also added
some parameters like MSISDN or the forbidden MCC to black-list other
national networks, in the idea that one would provision on the test
001/01 network. The data formats are not so well defined or clean as I
was on a get-it-done schedule and did not actually read the specs.
Anyway, the result works fine for me.

Otherwise I could only use pySIM with the GemPC Express reader. I read
that you have a PC Twin Reader which seems to be more common, but I am
getting the following with that, so any help would be appreciated:

Programming ...
Traceback (most recent call last):
  File "./pySim-prog.py", line 544, in <module>
    card.program(cp)
  File
"/root/svn/svnsrv.fokus.fraunhofer.de_OpenEPC/pysim/pySim/cards.py",
line 364, in program
    data, sw = self._scc._tp.send_apdu_checksw("0099000033" + par)
  File
"/root/svn/svnsrv.fokus.fraunhofer.de_OpenEPC/pysim/pySim/transport/__init__.py",
line 88, in send_apdu_checksw
    rv = self.send_apdu(pdu)
  File
"/root/svn/svnsrv.fokus.fraunhofer.de_OpenEPC/pysim/pySim/transport/__init__.py",
line 69, in send_apdu
    data, sw = self.send_apdu_raw(pdu)
  File
"/root/svn/svnsrv.fokus.fraunhofer.de_OpenEPC/pysim/pySim/transport/pcsc.py",
line 75, in send_apdu_raw
    data, sw1, sw2 = self._con.transmit(apdu)
  File
"/usr/lib/python2.7/dist-packages/smartcard/CardConnectionDecorator.py",
line 82, in transmit
    return self.component.transmit(bytes, protocol)
  File "/usr/lib/python2.7/dist-packages/smartcard/CardConnection.py",
line 140, in transmit
    data, sw1, sw2 = self.doTransmit(bytes, protocol)
  File
"/usr/lib/python2.7/dist-packages/smartcard/pcsc/PCSCCardConnection.py",
line 175, in doTransmit
    raise CardConnectionException('Failed to transmit with protocol ' +
dictProtocolHeader[pcscprotocolheader] + '. ' +
SCardGetErrorMessage(hresult))
smartcard.Exceptions.CardConnectionException: Failed to transmit with
protocol T0. Transaction failed.



P.S. I must apologize if the patch is crappy, as I could not yet be
bothered to read a book or something on python.

Cheers,
-Dragos

-- 
-----------------------------------------
Dipl. Eng. Dragos Vingarzan
Fraunhofer FOKUS/NGNI
Kaiserin-Augusta-Allee 31
10589 Berlin,Germany
Phone +49 (0)30 - 3463 - 7385
Mobile +49 (0)176 - 48 32 16 00
Web www.fokus.fraunhofer.de www.openepc.net www.openimscore.org
-----------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_usim.diff
Type: text/x-patch
Size: 6702 bytes
Desc: not available
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20120522/cc9bb4d7/attachment.bin>


More information about the OpenBSC mailing list