<p>herlesupreeth has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/pysim/+/17880">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pySim-read.py: Add ability to read by AID with correct CLA, P1 and P2 bytes<br><br>This commit add a check for whether a UICC has USIM/ISIM and changes the<br>CLA, P1 and P2 bytes if they are present, which allows selection of USIM by its AID.<br>Hence, enabling of reading all EFs under ADF USIM.<br><br>Ref: https://web.archive.org/web/20090630004017/http://cheef.ru/docs/HowTo/APDU.info<br><br>The above link provides the bytes to use for CLA, P1, P2 in APDU<br><br>Change-Id: Ifea328eff3a381d7b82118e22d2bc0ec5f8a87e4<br>---<br>M pySim-read.py<br>1 file changed, 13 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/80/17880/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/pySim-read.py b/pySim-read.py</span><br><span>index 3e25c76..9f7a305 100755</span><br><span>--- a/pySim-read.py</span><br><span>+++ b/pySim-read.py</span><br><span>@@ -236,6 +236,19 @@</span><br><span>     else:</span><br><span>                print("SIM Service Table: Can't read, response code = %s" % (sw,))</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+  # In order to select by AID, APDU must contain</span><br><span style="color: hsl(120, 100%, 40%);">+        # Cla: 00, Ins: A4, P1: 04, P2: 00, Data: AID</span><br><span style="color: hsl(120, 100%, 40%);">+ # Check whether card has U/ISIM application</span><br><span style="color: hsl(120, 100%, 40%);">+   for aid in card._aids:</span><br><span style="color: hsl(120, 100%, 40%);">+                # First (known) halves of the U/ISIM AID</span><br><span style="color: hsl(120, 100%, 40%);">+              if "a0000000871002" in aid or \</span><br><span style="color: hsl(120, 100%, 40%);">+                     "a0000000871004" in aid :</span><br><span style="color: hsl(120, 100%, 40%);">+                   scc._cla_byte = "00"</span><br><span style="color: hsl(120, 100%, 40%);">+                        scc.sel_ctrl = "0004"</span><br><span style="color: hsl(120, 100%, 40%);">+                       break</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       # Reconnect is needed after changing the CLA, P1 and P2 bytes</span><br><span style="color: hsl(120, 100%, 40%);">+ sl.reset_card()</span><br><span> </span><br><span>  # Done for this card and maybe for everything ?</span><br><span>      print("Done !\n")</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/pysim/+/17880">change 17880</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/pysim/+/17880"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: pysim </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ifea328eff3a381d7b82118e22d2bc0ec5f8a87e4 </div>
<div style="display:none"> Gerrit-Change-Number: 17880 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: herlesupreeth <herlesupreeth@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>