diff options
author | Supreeth Herle <herlesupreeth@gmail.com> | 2020-03-26 09:16:14 +0100 |
---|---|---|
committer | herlesupreeth <herlesupreeth@gmail.com> | 2021-01-05 11:46:41 +0100 |
commit | a5bd9684d3045a3c9bfd37ecd15001c45d43a21a (patch) | |
tree | 153eb933f076ee5348750ae65c50c17718cfc11e /pySim/cards.py | |
parent | 0c02d8a57b849b5c14991fdac1dd7232720f32ef (diff) |
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
Diffstat (limited to 'pySim/cards.py')
-rw-r--r-- | pySim/cards.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pySim/cards.py b/pySim/cards.py index 56597b0..62163a1 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -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'): |