laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38908?usp=email )
Change subject: esim.saip.File: Suppress encoding attributes that are like template ......................................................................
esim.saip.File: Suppress encoding attributes that are like template
The point of the SAIP template mechanism is to reduce the size of the encoded profile. Therefore, our encoder in the to_fileDescriptor() method should suppress generating attributes if their value is identical to that of the template (if any).
Change-Id: I337ee6c7e882ec711bece17b7a0def9da36b0ad7 --- M pySim/esim/saip/__init__.py 1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/08/38908/1
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 40ef4ce..94df453 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -216,13 +216,13 @@ fdb_dec = {} pefi = {} spfi = 0 - if self.fid: + if self.fid and self.fid != self.template.fid: fileDescriptor['fileID'] = self.fid.to_bytes(2, 'big') - if self.sfi: + if self.sfi and self.sfi != self.template.sfi: fileDescriptor['shortEFID'] = bytes([self.sfi]) if self.df_name: fileDescriptor['dfName'] = self.df_name - if self.arr: + if self.arr and self.arr != self.template.arr.to_bytes(1): fileDescriptor['securityAttributesReferenced'] = self.arr if self.file_type in ['LF', 'CY']: fdb_dec['file_type'] = 'working_ef'