Change in pysim[master]: sysmoISIM-SJA2: Add support for programming IMS Home Network Domain Name

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/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Jan 5 14:22:42 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/21866 )

Change subject: sysmoISIM-SJA2: Add support for programming IMS Home Network Domain Name
......................................................................

sysmoISIM-SJA2: Add support for programming IMS Home Network Domain Name

As per 3GPP TS 31.103, this EF (DOMAIN) can found under ADF.ISIM at File Id 6f03.

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 [27].
The tag value of the Home Network Domain Name TLV data object shall be '80'.

Example:

./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 -k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 -o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test --msisdn 0598765432100 --epdgid epdg.epc.mnc001.mcc001.pub.3gppnetwork.org --pcscf pcscf.testims.org --ims-hdomain testims.org

Change-Id: I3c823203aee88734ae423e4ad73da1027a4eaeed
---
M pySim-prog.py
M pySim/cards.py
2 files changed, 32 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/pySim-prog.py b/pySim-prog.py
index 7ad57e6..f278015 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -156,6 +156,9 @@
 	parser.add_option("--pcscf", dest="pcscf",
 			help="Set Proxy Call Session Control Function (P-CSCF) Address. (Only FQDN format supported)",
 		)
+	parser.add_option("--ims-hdomain", dest="ims_hdomain",
+			help="Set IMS Home Network Domain Name in FQDN format",
+		)
 	parser.add_option("--read-imsi", dest="read_imsi", action="store_true",
 			help="Read the IMSI from the CARD", default=False
 		)
@@ -464,6 +467,7 @@
 		'epdgid' : opts.epdgid,
 		'epdgSelection' : opts.epdgSelection,
 		'pcscf' : opts.pcscf,
+		'ims_hdomain': opts.ims_hdomain,
 	}
 
 
diff --git a/pySim/cards.py b/pySim/cards.py
index 42460fe..7e47916 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -28,6 +28,7 @@
 from pySim.ts_31_103 import EF_ISIM_ADF_map
 from pySim.utils import *
 from smartcard.util import toBytes
+from pytlv.TLV import *
 
 class Card(object):
 
@@ -346,6 +347,23 @@
 		else:
 			return (None, sw)
 
+	def update_domain(self, domain=None, mcc=None, mnc=None):
+		hex_str = ""
+		if domain:
+			hex_str = s2h(domain)
+		elif mcc and mnc:
+			# MCC and MNC always has 3 digits in domain form
+			plmn_str = 'mnc' + lpad(mnc, 3, "0") + '.mcc' + lpad(mcc, 3, "0")
+			hex_str = s2h('ims.' + plmn_str + '.3gppnetwork.org')
+
+		# Build TLV
+		tlv = TLV(['80'])
+		content = tlv.build({'80': hex_str})
+
+		bin_size_bytes = self._scc.binary_size(EF_ISIM_ADF_map['DOMAIN'])
+		data, sw = self._scc.update_binary(EF_ISIM_ADF_map['DOMAIN'], rpad(content, bin_size_bytes*2))
+		return sw
+
 
 class _MagicSimBase(Card):
 	"""
@@ -1238,6 +1256,16 @@
 					print("Programming P-CSCF failed with code %s"%sw)
 
 
+			# update EF.DOMAIN in ADF.ISIM
+			if self.file_exists(EF_ISIM_ADF_map['DOMAIN']):
+				if p.get('ims_hdomain'):
+					sw = self.update_domain(domain=p['ims_hdomain'])
+				else:
+					sw = self.update_domain()
+
+				if sw != '9000':
+					print("Programming Home Network Domain Name failed with code %s"%sw)
+
 		if '9000' == self.select_adf_by_aid():
 			# update EF-USIM_AUTH_KEY in ADF.USIM
 			if p.get('ki'):

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I3c823203aee88734ae423e4ad73da1027a4eaeed
Gerrit-Change-Number: 21866
Gerrit-PatchSet: 5
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210105/0b43f450/attachment.htm>


More information about the gerrit-log mailing list