laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/37509?usp=email )
Change subject: osmo-smdpp: Request enable/disable/delete notifications in metadata ......................................................................
osmo-smdpp: Request enable/disable/delete notifications in metadata
this way, the eUICC will send us notifications whenever our profiles are enabled/disabled/deleted.
Change-Id: I2861290864522b691b30b079c7c2e1466904df2d --- M osmo-smdpp.py M pySim/esim/es8p.py 2 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/09/37509/1
diff --git a/osmo-smdpp.py b/osmo-smdpp.py index cc4b121..e9638aa 100755 --- a/osmo-smdpp.py +++ b/osmo-smdpp.py @@ -376,6 +376,9 @@
# Put together profileMetadata + _bin ss.profileMetadata = ProfileMetadata(iccid_bin=h2b(swap_nibbles(iccid_str)), spn="OsmocomSPN", profile_name=matchingId) + # enable notifications for all operations + for event in ['enable', 'disable', 'delete']: + ss.profileMetadata.add_notification(event, self.server_hostname) profileMetadata_bin = ss.profileMetadata.gen_store_metadata_request()
# Put together smdpSigned2 + _bin diff --git a/pySim/esim/es8p.py b/pySim/esim/es8p.py index ff266ce..a5c88f0 100644 --- a/pySim/esim/es8p.py +++ b/pySim/esim/es8p.py @@ -25,6 +25,7 @@
import pySim.esim.rsp as rsp from pySim.esim.bsp import BspInstance +from pySim.esim import PMO
# Given that GSMA RSP uses ASN.1 in a very weird way, we actually cannot encode the full data type before # signing, but we have to build parts of it separately first, then sign that, so we can put the signature @@ -78,6 +79,11 @@ self.iccid_bin = iccid_bin self.spn = spn self.profile_name = profile_name + self.notifications = [] + + def add_notification(self, event: str, address: str): + """Add an 'other' notification to the notification configuration of the metadata""" + self.notifications.append((event, address))
def gen_store_metadata_request(self) -> bytes: """Generate encoded (but unsigned) StoreMetadataReqest DO (SGP.22 5.5.3)""" @@ -86,6 +92,12 @@ 'serviceProviderName': self.spn, 'profileName': self.profile_name, } + nci = [] + for n in self.notifications: + pmo = PMO(n[0]) + nci.append({'profileManagementOperation': pmo.to_bitstring(), 'notificationAddress': n[1]}) + if len(nci): + smr['notificationConfigurationInfo'] = nci return rsp.asn1.encode('StoreMetadataRequest', smr)