<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Billy,<div class=""><br class=""></div><div class="">Yes, according to the code you are trying with <span style="color: rgb(3, 47, 98); white-space: pre; background-color: rgb(255, 255, 255);" class="">4444444444444444, which is indeed </span><span style="color: rgb(31, 73, 125); font-family: Calibri, sans-serif; font-size: 11pt;" class="">DDDDDDDD.</span></div><div class=""><a href="https://github.com/osmocom/pysim/blob/master/pySim/cards.py#L375" class="">https://github.com/osmocom/pysim/blob/master/pySim/cards.py#L375</a></div><div class=""><br class=""></div><div class="">It is important to note that this is not the PIN-code you enter when you put the card into a phone, it is the super-admin PIN code/ADM key needed for programming if I understand the code correctly.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Domi</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">2017. szept. 27. dátummal, 19:35 időpontban Billy Jones <<a href="mailto:wljones@praxiseng.com" class="">wljones@praxiseng.com</a>> írta:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Domi,<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Thank you for the link!<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">So am I right in concluding that the SIM has a PIN associated with it and I’m not sending the correct one (from the code it looks like it’s sending “DDDDDDDD” as the default since I’m not specifying it in the command line)?<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Thanks again,<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Billy<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div class=""><div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(181, 196, 223); padding: 3pt 0in 0in;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><b class=""><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class="">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class=""><span class="Apple-converted-space"> </span>Tomcsányi Domonkos [<a href="mailto:domi@tomcsanyi.net" class="">mailto:domi@tomcsanyi.net</a>]<span class="Apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Wednesday, September 27, 2017 12:08 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Billy Jones<br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:openbsc@lists.osmocom.org" class="">openbsc@lists.osmocom.org</a><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: pySim inconsistent on seemingly identical SIM cards<o:p class=""></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Hi Billy,<o:p class=""></o:p></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Here you go:<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><a href="https://eftlab.co.uk/index.php/site-map/knowledge-base/118-apdu-response-list" style="color: purple; text-decoration: underline;" class="">https://eftlab.co.uk/index.php/site-map/knowledge-base/118-apdu-response-list</a><o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Good luck!<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Domi<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">2017. szept. 27. dátummal, 17:50 időpontban Billy Jones <<a href="mailto:wljones@praxiseng.com" style="color: purple; text-decoration: underline;" class="">wljones@praxiseng.com</a>> írta:<o:p class=""></o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class="">I have two SIM card I inheritted from a previous project that I've been told came from the same vendor.  When I run `pcsc_scan` on them, I get the following output for both:<br class=""><br class="">Reader 0: OMNIKEY CardMan (076B:3022) 3021 00 00<br class="">  Card state: Card inserted,<span class="apple-converted-space"> </span><br class="">  ATR: 3B 7D 94 00 00 55 55 53 0A 74 86 93 0B 24 7C 4D 54 68<br class=""><br class="">ATR: 3B 7D 94 00 00 55 55 53 0A 74 86 93 0B 24 7C 4D 54 68<br class="">+ TS = 3B --> Direct Convention<br class="">+ T0 = 7D, Y(1): 0111, K: 13 (historical bytes)<br class="">  TA(1) = 94 --> Fi=512, Di=8, 64 cycles/ETU<br class="">    62500 bits/s at 4 MHz, fMax for Fi = 5 MHz => 78125 bits/s<br class="">  TB(1) = 00 --> VPP is not electrically connected<br class="">  TC(1) = 00 --> Extra guard time: 0<br class="">+ Historical bytes: 55 55 53 0A 74 86 93 0B 24 7C 4D 54 68<br class="">  Category indicator byte: 55 (proprietary format)<br class=""><br class="">Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):<br class="">3B 7D 94 00 00 55 55 53 0A 74 86 93 0B 24 7C 4D 54 68<br class="">    SIM from sysmocom sysmoSIM-GR2<br class=""><br class="">When I try to program one of the SIMs, it works fine:<br class=""><br class="">$ sudo ./pySim-prog.py -p 0 -i 001010000000001 -k ffffffffffffffffffffffffffffffff -t sysmoSIM-GR2 --num=1 --mcc=001 --mnc=01<br class="">Insert card now (or CTRL-C to cancel)<br class="">Generated card parameters :<br class=""> > Name    : Magic<br class=""> > SMSP    : e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000<br class=""> > ICCID   : 8901001010000000017<br class=""> > MCC/MNC : 1/1<br class=""> > IMSI    : 001010000000001<br class=""> > Ki      : ffffffffffffffffffffffffffffffff<br class=""> > OPC     : f134b55cea2942ebbd213c82e084be62<br class=""> > ACC     : None<br class=""><br class="">Programming ...<br class="">Done !<br class=""><br class="">But on the other I get:<br class=""><br class="">$ sudo ./pySim-prog.py -p 0 -i 001010000000001 -k ffffffffffffffffffffffffffffffff -t sysmoSIM-GR2 --num=1 --mcc=001 --mnc=01<br class=""><br class="">Insert card now (or CTRL-C to cancel)<br class="">Generated card parameters :<br class=""> > Name    : Magic<br class=""> > SMSP    : e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000<br class=""> > ICCID   : 8901001010000000017<br class=""> > MCC/MNC : 1/1<br class=""> > IMSI    : 001010000000001<br class=""> > Ki      : ffffffffffffffffffffffffffffffff<br class=""> > OPC     : 53945a5223e299bf6cec05911922442c<br class=""> > ACC     : None<br class=""><br class="">Programming ...<br class="">Traceback (most recent call last):<br class="">  File "./pySim-prog.py", line 636, in <module><br class="">    card.program(cp)<br class="">  File "/home/user/workspace/pysim/pySim/cards.py", line 382, in program<br class="">    self._scc.verify_chv(0x05, pin)<br class="">  File "/home/user/workspace/pysim/pySim/commands.py", line 111, in verify_chv<br class="">    return self._tp.send_apdu_checksw(self.cla_byte + '2000' + ('%02X' % chv_no) + '08' + fc)<br class="">  File "/home/user/workspace/pysim/pySim/transport/__init__.py", line 87, in send_apdu_checksw<br class="">    raise RuntimeError("SW match failed ! Expected %s and got %s." % (sw.lower(), rv[1]))<br class="">RuntimeError: SW match failed ! Expected 9000 and got 9840.<br class=""><br class=""><br class="">I also tried some of the other branches, as people on other forums had reported better luck with those, but I get the same error.  Is there any documentation explaining the magic byte values that are sent back and forth to the card?  I'm having a hard time understanding the spec by which the program is trying too communicate with the card.<br class=""><br class="">Any help is greatly appreciated.<br class=""><br class="">Thanks,<br class="">Billy</span></div></div></div></blockquote></div></div></div></div></blockquote></div><br class=""></div></body></html>