laforge has uploaded this change for review. ( 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(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/12/38912/1
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 658810a..b65b398 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -1080,7 +1080,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):