Change in pysim[master]: pySim-read.py: Enable reading of Home Network Domain Name 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
Wed Dec 23 13:45:17 UTC 2020


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


Change subject: pySim-read.py: Enable reading of Home Network Domain Name from ISIM
......................................................................

pySim-read.py: Enable reading of Home Network Domain Name from ISIM

As per TS1.103 version 14.2.0, this EF contains the home operator's network domain name.
The Home Network Domain Name, i.e. FQDN shall be encoded to an octet string
according to UTF-8 encoding rules as specified in IETF RFC 3629

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



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

diff --git a/pySim-read.py b/pySim-read.py
index b6eeab7..4de520e 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -304,6 +304,17 @@
 		except Exception as e:
 			print("P-CSCF: Can't read file -- " + str(e))
 
+		# EF.DOMAIN - Home Network Domain Name
+		try:
+			if card.file_exists(EF_ISIM_ADF_map['DOMAIN']):
+				(res, sw) = card.read_domain()
+				if sw == '9000':
+					print("Home Network Domain Name: %s" % (len(res) and res or 'Not available',))
+				else:
+					print("Home Network Domain Name: Can't read, response code = %s" % (sw,))
+		except Exception as e:
+			print("Home Network Domain Name: 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 ced7e4c..31be141 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -328,6 +328,16 @@
 		data, sw = self._scc.update_record(EF_ISIM_ADF_map['PCSCF'], 1, rpad(content, rec_size_bytes*2))
 		return sw
 
+	def read_domain(self):
+		(res, sw) = self._scc.read_binary(EF_ISIM_ADF_map['DOMAIN'])
+		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)])
+			return (content, sw)
+		else:
+			return (None, sw)
+
 
 class _MagicSimBase(Card):
 	"""
diff --git a/pysim-testdata/sysmoISIM-SJA2.ok b/pysim-testdata/sysmoISIM-SJA2.ok
index 88872df..f925473 100644
--- a/pysim-testdata/sysmoISIM-SJA2.ok
+++ b/pysim-testdata/sysmoISIM-SJA2.ok
@@ -183,6 +183,7 @@
 	Not available
 	Not available
 
+Home Network Domain Name: 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/+/21858
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ia3c68c717d105e10d52a8e9d170480da2ad7d65a
Gerrit-Change-Number: 21858
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/20201223/61d5e782/attachment.htm>


More information about the gerrit-log mailing list