Change in pysim[master]: pySim-read.py: Add ability to read by AID with correct CLA, P1 and P2...

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/gerrit-log@lists.osmocom.org/.

herlesupreeth gerrit-no-reply at lists.osmocom.org
Mon Apr 20 08:26:49 UTC 2020


herlesupreeth has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/17880 )


Change subject: pySim-read.py: Add ability to read by AID with correct CLA, P1 and P2 bytes
......................................................................

pySim-read.py: Add ability to read by AID with correct CLA, P1 and P2 bytes

This commit add a check for whether a UICC has USIM/ISIM and changes the
CLA, P1 and P2 bytes if they are present, which allows selection of USIM by its AID.
Hence, enabling of reading all EFs under ADF USIM.

Ref: https://web.archive.org/web/20090630004017/http://cheef.ru/docs/HowTo/APDU.info

The above link provides the bytes to use for CLA, P1, P2 in APDU

Change-Id: Ifea328eff3a381d7b82118e22d2bc0ec5f8a87e4
---
M pySim-read.py
1 file changed, 13 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/80/17880/1

diff --git a/pySim-read.py b/pySim-read.py
index 3e25c76..9f7a305 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -236,6 +236,19 @@
 	else:
 		print("SIM Service Table: Can't read, response code = %s" % (sw,))
 
+	# In order to select by AID, APDU must contain
+	# Cla: 00, Ins: A4, P1: 04, P2: 00, Data: AID
+	# Check whether card has U/ISIM application
+	for aid in card._aids:
+		# First (known) halves of the U/ISIM AID
+		if "a0000000871002" in aid or \
+			"a0000000871004" in aid :
+			scc._cla_byte = "00"
+			scc.sel_ctrl = "0004"
+			break
+
+	# Reconnect is needed after changing the CLA, P1 and P2 bytes
+	sl.reset_card()
 
 	# Done for this card and maybe for everything ?
 	print("Done !\n")

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/17880
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ifea328eff3a381d7b82118e22d2bc0ec5f8a87e4
Gerrit-Change-Number: 17880
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200420/76d1e657/attachment.htm>


More information about the gerrit-log mailing list