aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSupreeth Herle <herlesupreeth@gmail.com>2020-03-25 10:23:48 +0100
committerherlesupreeth <herlesupreeth@gmail.com>2021-01-05 11:46:40 +0100
commit05b28071680015642275583211a8f47e99b54dfb (patch)
tree9fb1af36a2ddac8425740583c424b0662ee94fae
parentcf727f27335f42c066af02d3a0ac37b62971ed9f (diff)
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
-rwxr-xr-xpySim-read.py11
-rw-r--r--pySim/cards.py10
-rw-r--r--pysim-testdata/sysmoISIM-SJA2.ok1
3 files changed, 22 insertions, 0 deletions
diff --git a/pySim-read.py b/pySim-read.py
index b6eeab7..f63205a 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -304,6 +304,17 @@ if __name__ == '__main__':
except Exception as e:
print("P-CSCF: Can't read file -- " + str(e))
+ # EF.DOMAIN - Home Network Domain Name e.g. ims.mncXXX.mccXXX.3gppnetwork.org
+ 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 0b2d2a6..277b831 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -336,6 +336,16 @@ class IsimCard(Card):
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 03de57f..4cdd9d5 100644
--- a/pysim-testdata/sysmoISIM-SJA2.ok
+++ b/pysim-testdata/sysmoISIM-SJA2.ok
@@ -182,6 +182,7 @@ P-CSCF:
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