Change in pysim[master]: pySim-read.py: Enable reading of UICC IARI from ISIM

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
Tue Jan 5 14:53:18 UTC 2021


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


Change subject: pySim-read.py: Enable reading of UICC IARI from ISIM
......................................................................

pySim-read.py: Enable reading of UICC IARI from ISIM

Change-Id: Iba222421f2fcc2b9b12605608bf640f7627904d0
---
M pySim-read.py
M pySim/cards.py
M pysim-testdata/sysmoISIM-SJA2.ok
3 files changed, 31 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/58/21958/1

diff --git a/pySim-read.py b/pySim-read.py
index 4047598..b94e709 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -334,6 +334,14 @@
 		except Exception as e:
 			print("IMS public user identity: Can't read file -- " + str(e))
 
+		# EF.UICCIARI - UICC IARI
+		try:
+			if card.file_exists(EF_ISIM_ADF_map['UICCIARI']):
+				res = card.read_iari()
+				print("UICC IARI:\n%s" % (len(res) and res or '\tNot available\n',))
+		except Exception as e:
+			print("UICC IARI: Can't read file -- " + str(e))
+
 	# Check whether we have th AID of ISIM, if so select it by its AID
 	# EF.IST - File Id in ADF ISIM : 6f07
 	if '9000' == card.select_adf_by_aid(adf="isim"):
diff --git a/pySim/cards.py b/pySim/cards.py
index 7a61b68..850d084 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -424,6 +424,19 @@
 		data, sw = self._scc.update_record(EF_ISIM_ADF_map['IMPU'], 1, impu_tlv)
 		return sw
 
+	def read_iari(self):
+		rec_cnt = self._scc.record_count(EF_ISIM_ADF_map['UICCIARI'])
+		uiari_recs = ""
+		for i in range(0, rec_cnt):
+			(res, sw) = self._scc.read_record(EF_ISIM_ADF_map['UICCIARI'], i + 1)
+			if sw == '9000':
+				# Skip the inital tag value ('80') byte and get length of contents
+				length = int(res[2:4], 16)
+				content = h2s(res[4:4+(length*2)])
+				uiari_recs += "\t%s\n" % (len(content) and content or 'Not available')
+			else:
+				uiari_recs += "UICC IARI: Can't read, response code = %s\n" % (sw)
+		return uiari_recs
 
 class _MagicSimBase(Card):
 	"""
diff --git a/pysim-testdata/sysmoISIM-SJA2.ok b/pysim-testdata/sysmoISIM-SJA2.ok
index 26e20b0..e50db8b 100644
--- a/pysim-testdata/sysmoISIM-SJA2.ok
+++ b/pysim-testdata/sysmoISIM-SJA2.ok
@@ -194,6 +194,16 @@
 	Not available
 	Not available
 
+UICC IARI:
+	Not available
+	Not available
+	Not available
+	Not available
+	Not available
+	Not available
+	Not available
+	Not available
+
 ISIM Service Table: 190200
 	Service 1 - P-CSCF address
 	Service 4 - GBA-based Local Key Establishment Mechanism

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iba222421f2fcc2b9b12605608bf640f7627904d0
Gerrit-Change-Number: 21958
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/20210105/a3cb5dd8/attachment.htm>


More information about the gerrit-log mailing list