sysmoISIM-SJA2: Add support for programming IMS private user identity
This EF contains the private user identity of the user. EF.IMPI consist of NAI TLV data object values see IETF RFC 2486. The NAI 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@ims.testop.org Change-Id: Ic1ccf99b5aa45297ef1e43a43373df603f756379
This commit is contained in:
committed by
herlesupreeth
parent
0c02d8a57b
commit
a5bd9684d3
@@ -159,6 +159,9 @@ def parse_options():
|
||||
parser.add_option("--ims-hdomain", dest="ims_hdomain",
|
||||
help="Set IMS Home Network Domain Name in FQDN format",
|
||||
)
|
||||
parser.add_option("--impi", dest="impi",
|
||||
help="Set IMS private user identity",
|
||||
)
|
||||
parser.add_option("--read-imsi", dest="read_imsi", action="store_true",
|
||||
help="Read the IMSI from the CARD", default=False
|
||||
)
|
||||
@@ -468,6 +471,7 @@ def gen_parameters(opts):
|
||||
'epdgSelection' : opts.epdgSelection,
|
||||
'pcscf' : opts.pcscf,
|
||||
'ims_hdomain': opts.ims_hdomain,
|
||||
'impi' : opts.impi
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -385,6 +385,18 @@ class IsimCard(Card):
|
||||
else:
|
||||
return (None, sw)
|
||||
|
||||
def update_impi(self, impi=None):
|
||||
hex_str = ""
|
||||
if impi:
|
||||
hex_str = s2h(impi)
|
||||
# Build TLV
|
||||
tlv = TLV(['80'])
|
||||
content = tlv.build({'80': hex_str})
|
||||
|
||||
bin_size_bytes = self._scc.binary_size(EF_ISIM_ADF_map['IMPI'])
|
||||
data, sw = self._scc.update_binary(EF_ISIM_ADF_map['IMPI'], rpad(content, bin_size_bytes*2))
|
||||
return sw
|
||||
|
||||
def read_impu(self):
|
||||
rec_cnt = self._scc.record_count(EF_ISIM_ADF_map['IMPU'])
|
||||
impu_recs = ""
|
||||
@@ -1301,6 +1313,16 @@ class SysmoISIMSJA2(UsimCard, IsimCard):
|
||||
if sw != '9000':
|
||||
print("Programming Home Network Domain Name failed with code %s"%sw)
|
||||
|
||||
# update EF.IMPI in ADF.ISIM
|
||||
# TODO: Validate IMPI input
|
||||
if self.file_exists(EF_ISIM_ADF_map['IMPI']):
|
||||
if p.get('impi'):
|
||||
sw = self.update_impi(p['impi'])
|
||||
else:
|
||||
sw = self.update_impi()
|
||||
if sw != '9000':
|
||||
print("Programming IMPI failed with code %s"%sw)
|
||||
|
||||
if '9000' == self.select_adf_by_aid():
|
||||
# update EF-USIM_AUTH_KEY in ADF.USIM
|
||||
if p.get('ki'):
|
||||
|
||||
Reference in New Issue
Block a user