laforge has submitted this change. (
https://gerrit.osmocom.org/c/pysim/+/38912?usp=email
)
Change subject: esim.saip.ProfileElementUSIM: Fix IMSI decode if [only] template based
......................................................................
esim.saip.ProfileElementUSIM: Fix IMSI decode if [only] template based
In case the fileDescriptor of EF.IMSI is purely template based and only
the file content is given in the actual profile, we must pass a template
reference to the File() constructor before we can read the IMSI.
This fixes the following exception for some profiles:
ValueError: File(ef-imsi): No fileDescriptor found in tuple, and none set by template
before
Change-Id: I14157a7b62ccd9b5b42de9b8060f2ebc5f91ebb3
---
M pySim/esim/saip/__init__.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 2552c8e..64ea7cb 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -1130,7 +1130,8 @@
@property
def imsi(self) -> Optional[str]:
- f = File('ef-imsi', self.decoded['ef-imsi'])
+ template = templates.ProfileTemplateRegistry.get_by_oid(self.templateID)
+ f = File('ef-imsi', self.decoded['ef-imsi'],
template.files_by_pename.get('ef-imsi', None))
return dec_imsi(b2h(f.body))
class ProfileElementOptUSIM(FsProfileElement):
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/38912?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I14157a7b62ccd9b5b42de9b8060f2ebc5f91ebb3
Gerrit-Change-Number: 38912
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>