Change in pysim[master]: sysmoISIM-SJA2: Add support for programming IMS public user identity

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 15:37:09 UTC 2021


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

Change subject: sysmoISIM-SJA2: Add support for programming IMS public user identity
......................................................................

sysmoISIM-SJA2: Add support for programming IMS public user identity

This EF contains one or more records, with each record able
to hold a public SIP Identity (SIP URI) of the user. EF.IMPU consist of URI TLV data
object values see IETF RFC 3261. The URI shall be encoded to an octet string according
to UTF-8 encoding rules as specified in IETF RFC 3629

./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.ims.testop.org --ims-hdomain ims.testop.org --impi 1234567895 at ims.testop.org --impu sip:5987654321 at ims.testop.org

Change-Id: If10bc2e50eca390b81755b5cc7211e695233612d
---
M pySim-prog.py
M pySim/cards.py
2 files changed, 29 insertions(+), 1 deletion(-)

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



diff --git a/pySim-prog.py b/pySim-prog.py
index 3abd0bd..cf503d0 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -162,6 +162,9 @@
 	parser.add_option("--impi", dest="impi",
 			help="Set IMS private user identity",
 		)
+	parser.add_option("--impu", dest="impu",
+			help="Set IMS public user identity",
+		)
 	parser.add_option("--read-imsi", dest="read_imsi", action="store_true",
 			help="Read the IMSI from the CARD", default=False
 		)
@@ -471,7 +474,8 @@
 		'epdgSelection' : opts.epdgSelection,
 		'pcscf' : opts.pcscf,
 		'ims_hdomain': opts.ims_hdomain,
-		'impi' : opts.impi
+		'impi' : opts.impi,
+		'impu' : opts.impu,
 	}
 
 
diff --git a/pySim/cards.py b/pySim/cards.py
index 62163a1..ac6d223 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -411,6 +411,19 @@
 				impu_recs += "IMS public user identity: Can't read, response code = %s\n" % (sw)
 		return impu_recs
 
+	def update_impu(self, impu=None):
+		hex_str = ""
+		if impu:
+			hex_str = s2h(impu)
+		# Build TLV
+		tlv = TLV(['80'])
+		content = tlv.build({'80': hex_str})
+
+		rec_size_bytes = self._scc.record_size(EF_ISIM_ADF_map['IMPU'])
+		impu_tlv = rpad(content, rec_size_bytes*2)
+		data, sw = self._scc.update_record(EF_ISIM_ADF_map['IMPU'], 1, impu_tlv)
+		return sw
+
 
 class _MagicSimBase(Card):
 	"""
@@ -1323,6 +1336,17 @@
 				if sw != '9000':
 					print("Programming IMPI failed with code %s"%sw)
 
+			# update EF.IMPU in ADF.ISIM
+			# TODO: Validate IMPU input
+			# Support multiple IMPU if there is enough space
+			if self.file_exists(EF_ISIM_ADF_map['IMPU']):
+				if p.get('impu'):
+					sw = self.update_impu(p['impu'])
+				else:
+					sw = self.update_impu()
+				if sw != '9000':
+					print("Programming IMPU 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/+/21955
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: If10bc2e50eca390b81755b5cc7211e695233612d
Gerrit-Change-Number: 21955
Gerrit-PatchSet: 1
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/420e3eb1/attachment.htm>


More information about the gerrit-log mailing list