laforge has submitted this change. (
https://gerrit.osmocom.org/c/pysim/+/37421?usp=email
)
Change subject: pySim.saip: Add ProfileElementRFM class
......................................................................
pySim.saip: Add ProfileElementRFM class
Change-Id: I547e02c12345932deafa4b914fcaeaa183b69798
---
M pySim/esim/saip/__init__.py
M tests/test_esim_saip.py
2 files changed, 44 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index e87e5c0..e5173d7 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -553,6 +553,34 @@
'uiccToolkitApplicationSpecificParametersField':
h2b('01000001000000020112036C756500'),
}
+class ProfileElementRFM(ProfileElement):
+ type = 'rfm'
+
+ def __init__(self, decoded: Optional[dict] = None,
+ inst_aid: Optional[bytes] = None, sd_aid: Optional[bytes] = None,
+ adf_aid: Optional[bytes] = None,
+ tar_list: Optional[List[bytes]] = [], msl: Optional[int] = 0x06):
+ super().__init__()
+ ADM1_ACCESS = h2b('02000100')
+ if decoded:
+ self.decoded = decoded
+ return
+ # provide some reasonable defaults for a MNO-SD
+ self.decoded = OrderedDict()
+ self.decoded['rfm-header'] = { 'mandated': None,
'identification': None}
+ self.decoded['instanceAID'] = inst_aid
+ self.decoded['securityDomainAID'] = sd_aid
+ self.decoded['tarList'] = tar_list
+ self.decoded['minimumSecurityLevel'] = bytes([msl])
+ self.decoded['uiccAccessDomain'] = ADM1_ACCESS
+ self.decoded['uiccAdminAccessDomain'] = ADM1_ACCESS
+ if adf_aid:
+ self.decoded['adfRFMAccess'] = {
+ 'adfAID': adf_aid,
+ 'adfAccessDomain': ADM1_ACCESS,
+ 'adfAdminAccessDomain': ADM1_ACCESS,
+ }
+
class ProfileElementUSIM(ProfileElement):
type = 'usim'
diff --git a/tests/test_esim_saip.py b/tests/test_esim_saip.py
index 5a1284e..e87a073 100755
--- a/tests/test_esim_saip.py
+++ b/tests/test_esim_saip.py
@@ -74,6 +74,13 @@
pes.append(inst)
pes.to_der()
+ # RFM requires some constructor arguments
+ cls = ProfileElementRFM
+ with self.subTest(cls.__name__):
+ pes = ProfileElementSequence()
+ inst = cls(inst_aid=b'\x01\x02', sd_aid=b'\x03\x04',
tar_list=[b'\x01\x02\x03'])
+ pes.append(inst)
+ pes.to_der()
if __name__ == "__main__":
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/37421?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I547e02c12345932deafa4b914fcaeaa183b69798
Gerrit-Change-Number: 37421
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged