From 52df66cd56e0823564cbc84831663b75078ac8a1 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 18 Nov 2025 01:05:59 +0100 Subject: [PATCH] pySim.esim.es8p: Support non-operational ProfileMetadata If no profileClass is given, ProfileMetadata defaults to operational. Let's add the capability to also generate metadata for test or provisioning profiles. Change-Id: Id55537ed03e2690c1fc9545bb3c49cfc76d8e331 --- pySim/esim/es8p.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pySim/esim/es8p.py b/pySim/esim/es8p.py index 9c76084f..6926caeb 100644 --- a/pySim/esim/es8p.py +++ b/pySim/esim/es8p.py @@ -76,10 +76,11 @@ def gen_replace_session_keys(ppk_enc: bytes, ppk_cmac: bytes, initial_mcv: bytes class ProfileMetadata: """Representation of Profile metadata. Right now only the mandatory bits are supported, but in general this should follow the StoreMetadataRequest of SGP.22 5.5.3""" - def __init__(self, iccid_bin: bytes, spn: str, profile_name: str): + def __init__(self, iccid_bin: bytes, spn: str, profile_name: str, profile_class = 'operational'): self.iccid_bin = iccid_bin self.spn = spn self.profile_name = profile_name + self.profile_class = profile_class self.icon = None self.icon_type = None self.notifications = [] @@ -105,6 +106,14 @@ class ProfileMetadata: 'serviceProviderName': self.spn, 'profileName': self.profile_name, } + if self.profile_class == 'test': + smr['profileClass'] = 0 + elif self.profile_class == 'provisioning': + smr['profileClass'] = 1 + elif self.profile_class == 'operational': + smr['profileClass'] = 2 + else: + raise ValueError('Unsupported Profile Class %s' % self.profile_class) if self.icon: smr['icon'] = self.icon smr['iconType'] = self.icon_type