lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

November 2026

  • 1 participants
  • 714 discussions
[S] Change in libosmocore[master]: gb: ns2: clamp embedded NS PDU to msgb tailroom
by laforge 19 Nov '26

19 Nov '26
Attention is currently required from: daniel, fixeria, lynxis, pespin, ws1004. laforge has posted comments on this change by ws1004. ( https://gerrit.osmocom.org/c/libosmocore/+/44138?usp=email ) Change subject: gb: ns2: clamp embedded NS PDU to msgb tailroom ...................................................................... Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44138?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Iac1c5c15875f30f34d0f7e9fc74264530a02b6ae Gerrit-Change-Number: 44138 Gerrit-PatchSet: 3 Gerrit-Owner: ws1004 <ws1004(a)kakao.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <daniel(a)totalueberwachung.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis <lynxis(a)fe80.eu> Gerrit-Attention: daniel <daniel(a)totalueberwachung.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: ws1004 <ws1004(a)kakao.com> Gerrit-Comment-Date: Thu, 19 Nov 2026 15:34:14 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XL] Change in pysim[master]: cattp: ETSI TS 102 127 transport for OTA over BIP UDP
by dexter 19 Nov '26

19 Nov '26
Attention is currently required from: Hoernchen. dexter has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43719?usp=email ) Change subject: cattp: ETSI TS 102 127 transport for OTA over BIP UDP ...................................................................... Patch Set 2: Code-Review+1 (2 comments) File pySim/cattp.py: https://gerrit.osmocom.org/c/pysim/+/43719/comment/64dee19c_3cfc4e28?usp=em… : PS2, Line 99: NoVar = Struct(Terminated) maybe re-order those a bit. SynVar,RstVar,EackVar,NoVar is the order in var_struct https://gerrit.osmocom.org/c/pysim/+/43719/comment/15982e8f_255fa46b?usp=em… : PS2, Line 102: 'nul': FLAG_NUL, 'seg': FLAG_SEG} maybe put those next to the constants? Or above the definition of PduStruct? You are using the constants but not FLAG_BITS directly here, so now this dict is between the var_struct and the struct definitions above. This is a bit confusing. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43719?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I6f31493c1f0fb48fb3fd5382d8af2c905d365e54 Gerrit-Change-Number: 43719 Gerrit-PatchSet: 2 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Comment-Date: Thu, 19 Nov 2026 13:17:44 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in pysim[master]: global_platform: add tracked security domain selection
by laforge 19 Nov '26

19 Nov '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/43724?usp=email ) Change subject: global_platform: add tracked security domain selection ...................................................................... global_platform: add tracked security domain selection select_security_domain <aid> does SELECT by AID and models the result as an ADF_SD, so the GP commands, prompt and CardKeyProvider identity work. Plain select cannot do this: probe_file() classifies by the ISO FCP, an application answers with a GP FCI, and whether that FCI belongs to a Security Domain is not obvious (GPC 11.9.3.1 table 11-56 tag 73 is optional, the sysmoEUICC1 omits it). The CardKeyProvider identity (ICCID vs EID) used for csv lookup of credentials is (obviously) not part of the answer at all. This new command makes using the eUICC with MNO-SDs and SSDs easier, because so far we only had raw apdus to select those that led to a confused internal pysim state, i.e. install_cap after selecting like that would try to install to the ISD-R. Change-Id: I7c6dda0f11dc6bb175f05b3832cf49691089c297 --- M docs/put_key-tutorial.rst M docs/shell.rst M pySim/global_platform/__init__.py M tests/unittests/test_globalplatform.py 4 files changed, 221 insertions(+), 12 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified dexter: Looks good to me, approved diff --git a/docs/put_key-tutorial.rst b/docs/put_key-tutorial.rst index fe49729..8585167 100644 --- a/docs/put_key-tutorial.rst +++ b/docs/put_key-tutorial.rst @@ -44,10 +44,10 @@ `MNO-SD` is either the default AID for the Issuer Security Domain (see also GlobalPlatform, section H.1.3) or a different value specified by the provider of the eSIM profile. -Since the AID of the `MNO-SD` is not a fixed value, it is not known by `pySim-shell`. This means there will be no -`ADF.ISD` file shown in the file system, but we can simply select the `ADF.ISD-R` first and then select the `MNO-SD` -using a raw APDU. In the following example we assume that the default AID (``a000000151000000``) is used The APDU -would look like this: ``00a4040408`` + ``a000000151000000`` + ``00`` +Since the AID of the `MNO-SD` is not a fixed value, it is not part of pySim's static card profile. Select a known +Security Domain such as `ADF.ISD-R` first to make the GlobalPlatform commands available, then use +``select_security_domain`` with the MNO-SD AID. Do not select it with a raw ``apdu``, that desyncs pySim's internal +card model. In the following example we assume that the default AID (``a000000151000000``) is used. :: @@ -61,14 +61,55 @@ "supported_version_number": "020300" } } - pySIM-shell (00:MF/ADF.ISD-R)> apdu 00a4040408a00000015100000000 - SW: 9000, RESP: 6f108408a000000151000000a5049f6501ff + pySIM-shell (00:MF/ADF.ISD-R)> select_security_domain a000000151000000 + CardKeyProvider identity: ICCID + { + "application_id": "a000000151000000", + "proprietary_data": { + "maximum_length_of_data_field_in_command_message": 255 + } + } -After that, the prompt will still show the `ADF.ISD-R`, but we are actually in `ADF.ISD` and the standard GlobalPlatform -operations like `establish_scpXX`, `get_data`, and `put_key` should work. By doing this, we simply have tricked -`pySim-shell` into making the GlobalPlatform related commands available for some other Security Domain we are not -interested in. With the raw APDU we then have swapped out the Security Domain under the hood. The same workaround can -be applied to any Security Domain, provided that the AID is known to the user. +The dynamically discovered Security Domain uses the profile ICCID for CardKeyProvider lookup by default, which is +appropriate for an MNO-SD. Use ``--key-provider-identity EID`` for an eUICC-global Security Domain instead. The command +must be used before establishing SCP; use ``release_scp`` before switching away from a Security Domain with an active +SCP session. If the enabled profile changes during the shell session, re-equip the card before selecting its MNO-SD; +different profiles commonly reuse the same MNO-SD AID, while their key lookup is tied to the profile ICCID. + +Selecting a Supplementary Security Domain (SSD) +------------------------------------------------ + +``select_security_domain`` is not limited to an MNO-SD. It can also select a Supplementary Security Domain (SSD), +provided that the SSD is in a selectable life-cycle state. An SSD frequently has no filesystem alias and need not be +listed in ``EF.DIR``; select it using its instance AID. + +The SSD AID can be obtained from the profile or installation data. It can also be discovered with +``get_status applications`` while operating through its controlling Security Domain. Look for an application registry +entry with the ``security_domain`` privilege and a selectable life-cycle state. + +The following example assumes that an SSD with AID ``a000000151000042`` was created beneath the active profile's +MNO-SD. Any SCP session with the MNO-SD must first be released. Selecting the SSD does not carry the parent's secure +channel into the SSD: establish a new secure channel using the SSD's own keyset afterwards. + +:: + + pySIM-shell (SCP03[03]:00:MF/ADF.SD-A000000151000000)> get_status applications + # Locate the selectable registry entry with the security_domain privilege. + pySIM-shell (SCP03[03]:00:MF/ADF.SD-A000000151000000)> release_scp + pySIM-shell (00:MF/ADF.SD-A000000151000000)> select_security_domain a000000151000042 + CardKeyProvider identity: ICCID + { + "application_id": "a000000151000042" + } + pySIM-shell (00:MF/ADF.SD-A000000151000042)> establish_scp03 --key-ver 1 --key-enc <SSD-ENC> --key-mac <SSD-MAC> --key-dek <SSD-DEK> --security-level 3 + +For a newly installed SSD, ``install_for_install --privilege security_domain --make-selectable`` creates it as a +selectable Security Domain. If SELECT-by-AID fails because the SSD is not selectable, it must first be moved to the +appropriate life-cycle state through its controlling Security Domain. Remote administration that targets an SSD by +AID (for example through SCP81) is a separate mechanism and does not imply that contact-interface SELECT is enabled. + +As with an MNO-SD, profile-scoped SSD key lookup normally uses the default ``ICCID`` identity. Use +``--key-provider-identity EID`` only when the SSD's keys are associated with the eUICC rather than the enabled profile. Establishing a secure channel @@ -135,7 +176,7 @@ :: - pySIM-shell (00:MF/ADF.ISD-R)> establish_scp03 --key-enc 63af517c29ad6ac6fcadfe6ac8a3c8a041d8141c7eb845ef1cba6112a325e430 --key-mac 54b9ad6713ae922f54014ed762132e7b59bdcd2a2a6beba98fb9afe6b4df27e1 --key-dek cbb933ba2389da93c86c112739cd96389139f16c6f80f7d16bf3593e407ca893 --key-ver 48 --security-level 3 + pySIM-shell (00:MF/ADF.SD-A000000151000000)> establish_scp03 --key-enc 63af517c29ad6ac6fcadfe6ac8a3c8a041d8141c7eb845ef1cba6112a325e430 --key-mac 54b9ad6713ae922f54014ed762132e7b59bdcd2a2a6beba98fb9afe6b4df27e1 --key-dek cbb933ba2389da93c86c112739cd96389139f16c6f80f7d16bf3593e407ca893 --key-ver 48 --security-level 3 Successfully established a SCP03[03] secure channel diff --git a/docs/shell.rst b/docs/shell.rst index 0dc00ba..53e55d1 100644 --- a/docs/shell.rst +++ b/docs/shell.rst @@ -1030,6 +1030,12 @@ pySim-shell has only the mots rudimentary support for GlobalPlatform at this point. Please use dedicated projects like GlobalPlatformPro meanwhile. +select_security_domain +~~~~~~~~~~~~~~~~~~~~~~ +.. argparse:: + :module: pySim.global_platform + :func: ADF_SD.AddlShellCommands.select_sd_parser + get_data ~~~~~~~~ .. argparse:: diff --git a/pySim/global_platform/__init__.py b/pySim/global_platform/__init__.py index 9600c7c..854e73b 100644 --- a/pySim/global_platform/__init__.py +++ b/pySim/global_platform/__init__.py @@ -609,6 +609,57 @@ @with_default_category('Application-Specific Commands') class AddlShellCommands(CommandSet): + select_sd_parser = argparse.ArgumentParser() + select_sd_parser.add_argument('aid', type=is_hexstr, + help='AID of the Security Domain') + select_sd_parser.add_argument('--key-provider-identity', choices=['ICCID', 'EID'], + help='CardKeyProvider identity for this Security Domain; ' + 'default: retain it for a known SD, otherwise ICCID') + + @cmd2.with_argparser(select_sd_parser) + def do_select_security_domain(self, opts): + """Select a Security Domain by AID, e.g. the MNO-SD of an eUICC profile, and + add it to the runtime card model so the GP commands and key lookup follow.""" + # select() unregisters this CommandSet, self._cmd is gone afterwards + cmd_app = self._cmd + lchan = cmd_app.lchan + if lchan.scc.scp: + raise RuntimeError('Cannot select another Security Domain while an SCP session is active; ' + 'use release_scp first') + + aid = opts.aid.lower() + if not 10 <= len(aid) <= 32: + raise ValueError('A Security Domain AID must be between 5 and 16 bytes') + mf = cmd_app.rs.mf + adf = mf.applications.get(aid) + added = False + if adf is None: + app = CardApplicationSD(aid=aid, + name='ADF.SD-' + aid.upper(), + desc='Runtime-discovered Security Domain') + adf = app.adf + adf.scp_key_identity = opts.key_provider_identity or 'ICCID' + mf.add_application_df(adf) + added = True + elif not isinstance(adf, ADF_SD): + raise ValueError('Application %s is already known, but is not modelled as a Security Domain' % aid) + + try: + fcp_dec = lchan.select(aid, cmd_app) + except Exception: + if added: + # clean up on rejected select + mf.applications.pop(aid, None) + adf.parent = None + raise + + if not added and opts.key_provider_identity: + adf.scp_key_identity = opts.key_provider_identity + cmd_app.update_prompt() + cmd_app.poutput('CardKeyProvider identity: %s' % + (adf.scp_key_identity or 'not configured')) + cmd_app.poutput_json(fcp_dec) + get_data_parser = argparse.ArgumentParser() get_data_parser.add_argument('data_object_name', type=str, help='Name of the data object to be retrieved from the card') diff --git a/tests/unittests/test_globalplatform.py b/tests/unittests/test_globalplatform.py index d329c45..67c07a9 100644 --- a/tests/unittests/test_globalplatform.py +++ b/tests/unittests/test_globalplatform.py @@ -31,6 +31,117 @@ KIK = h2b('102102030405060708090a0b0c0d0e0f') # DEK ck_3des_70 = GpCardKeyset(0x20, KIC, KID, KIK) + +class SelectSecurityDomain_Test(unittest.TestCase): + class _FakeMf: + def __init__(self): + self.applications = {} + + def add_application_df(self, adf): + if adf.aid in self.applications: + raise ValueError('duplicate AID') + self.applications[adf.aid] = adf + adf.parent = self + + class _FakeLchan: + def __init__(self, mf, fail_select=False): + self.rs = SimpleNamespace(mf=mf) + self.scc = SimpleNamespace(scp=None) + self.fail_select = fail_select + self.select_calls = [] + self.selected_file = None + self.selected_adf = None + self.selected_file_fcp = None + + def select(self, aid, cmd): + self.select_calls.append((aid, cmd)) + if self.fail_select: + raise RuntimeError('SELECT failed') + self.selected_file = self.rs.mf.applications[aid] + self.selected_adf = self.selected_file + self.selected_file_fcp = {'application_id': aid} + return self.selected_file_fcp + + def _run(self, aid='a000000151000000', key_provider_identity=None, + mf=None, fail_select=False, scp=None, lose_selector_cmd=False): + mf = mf or self._FakeMf() + lchan = self._FakeLchan(mf, fail_select=fail_select) + lchan.scc.scp = scp + output = [] + cmd = SimpleNamespace( + lchan=lchan, + rs=lchan.rs, + update_prompt=lambda: output.append(('prompt',)), + poutput=lambda value: output.append(('text', value)), + poutput_json=lambda value: output.append(('json', value)), + ) + if lose_selector_cmd: + # make sure cmd survives unregistering + class Selector(ADF_SD.AddlShellCommands): + @property + def _cmd(self): + if lchan.selected_file is not None: + raise RuntimeError('CommandSet was unregistered') + return cmd + else: + Selector = type('Selector', (ADF_SD.AddlShellCommands,), {'_cmd': cmd}) + selector = Selector.__new__(Selector) + opts = SimpleNamespace(aid=aid, key_provider_identity=key_provider_identity) + # the undecorated method, set by functools.wraps in cmd2.with_argparser + # pylint: disable-next=no-member + ADF_SD.AddlShellCommands.do_select_security_domain.__wrapped__(selector, opts) + return mf, lchan, output + + def test_new_security_domain_is_selected_and_tracked(self): + mf, lchan, output = self._run() + adf = mf.applications['a000000151000000'] + self.assertIsInstance(adf, ADF_SD) + self.assertEqual(adf.scp_key_identity, 'ICCID') + self.assertIs(lchan.selected_file, adf) + self.assertIs(lchan.selected_adf, adf) + self.assertEqual(output[-1], ('json', {'application_id': 'a000000151000000'})) + + def test_success_survives_executing_command_set_being_unregistered(self): + _mf, lchan, output = self._run(lose_selector_cmd=True) + self.assertEqual(lchan.selected_file_fcp, + {'application_id': 'a000000151000000'}) + self.assertEqual(output[-1], ('json', lchan.selected_file_fcp)) + + def test_explicit_key_provider_identity(self): + mf, _lchan, _output = self._run(key_provider_identity='EID') + self.assertEqual(mf.applications['a000000151000000'].scp_key_identity, 'EID') + + def test_known_security_domain_retains_identity_by_default(self): + mf = self._FakeMf() + app = CardApplicationSD('a000000151000000', 'ADF.TEST-SD', 'Test SD') + app.adf.scp_key_identity = 'EID' + mf.add_application_df(app.adf) + self._run(mf=mf) + self.assertEqual(app.adf.scp_key_identity, 'EID') + + def test_active_scp_is_rejected(self): + mf = self._FakeMf() + with self.assertRaisesRegex(RuntimeError, 'release_scp'): + self._run(mf=mf, scp=object()) + self.assertEqual(mf.applications, {}) + + def test_invalid_aid_length_is_rejected(self): + with self.assertRaisesRegex(ValueError, 'between 5 and 16 bytes'): + self._run(aid='01020304') + + def test_failed_select_is_not_retained(self): + mf = self._FakeMf() + with self.assertRaises(RuntimeError): + self._run(mf=mf, fail_select=True) + self.assertEqual(mf.applications, {}) + + def test_parser_accepts_security_domain_aid(self): + opts = ADF_SD.AddlShellCommands.select_sd_parser.parse_args( + ['a000000151000000', '--key-provider-identity', 'EID']) + self.assertEqual(opts.aid, 'a000000151000000') + self.assertEqual(opts.key_provider_identity, 'EID') + + class SCP02_Auth_Test(unittest.TestCase): host_challenge = h2b('40A62C37FA6304F8') init_update_resp = h2b('00000000000000000000700200016B4524ABEE7CF32EA3838BC148F3') -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43724?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: I7c6dda0f11dc6bb175f05b3832cf49691089c297 Gerrit-Change-Number: 43724 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in pysim[master]: euicc: fix profile reset DER encoding
by laforge 19 Nov '26

19 Nov '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/43725?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: euicc: fix profile reset DER encoding ...................................................................... euicc: fix profile reset DER encoding ResetOptions is an ASN.1 BIT STRING, DER encodes it with the unused bit count first and trailing zero bits stripped, so deleteOperationalProfiles alone is 07 80, not plain 80 produced by FlagsEnum(Byte). Why does this look so fancy? Well, construct has no DER BIT STRING primitive, and the flat decoded dict ({'deleteOperationalProfiles': True, ...}) that the shell euicc_memory_reset passes has to survive, so something must flatten the unused bit prefix. Change-Id: I318ea7b08bad9e0b34b14929ef750151f4c5fa4e --- M pySim/euicc.py M tests/unittests/test_euicc.py 2 files changed, 59 insertions(+), 4 deletions(-) Approvals: dexter: Looks good to me, but someone else must approve Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/pySim/euicc.py b/pySim/euicc.py index 0a6c054..fdcb9e8 100644 --- a/pySim/euicc.py +++ b/pySim/euicc.py @@ -25,7 +25,8 @@ import argparse -from construct import Array, Struct, FlagsEnum, GreedyRange +from construct import Array, Struct, FlagsEnum, GreedyRange, Adapter, Byte, Int8ub +from construct import Optional as COptional from cmd2 import cmd2, CommandSet, with_default_category from osmocom.utils import Hexstr from osmocom.tlv import * @@ -288,11 +289,32 @@ pass # SGP.22 Section 5.7.19: EuiccMemoryReset +class DerNamedBitString(Adapter): + """ASN.1 DER named BIT STRING over a FlagsEnum(Byte): the count of unused bits comes first, + trailing zero bits are stripped, all bits clear is the single octet 00.""" + def __init__(self, flags: FlagsEnum): + super().__init__(Struct('unused'/Int8ub, 'value'/COptional(Byte))) + self.flags = flags + + def _decode(self, obj, context, path): + if obj.value is None: + return self.flags.parse(b'\x00') + if obj.unused > 7 or obj.value & ((1 << obj.unused) - 1): + raise ValueError('invalid DER BIT STRING padding') + return self.flags.parse(bytes([obj.value])) + + def _encode(self, obj, context, path): + value = self.flags.build(obj)[0] + if not value: + return {'unused': 0, 'value': None} + return {'unused': (value & -value).bit_length() - 1, 'value': value} + +ResetOptionsFlags = FlagsEnum(Byte, deleteOperationalProfiles=0x80, deleteFieldLoadedTestProfiles=0x40, + resetDefaultSmdpAddress=0x20) class ResetOptions(BER_TLV_IE, tag=0x82): - _construct = FlagsEnum(Byte, deleteOperationalProfiles=0x80, deleteFieldLoadedTestProfiles=0x40, - resetDefaultSmdpAddress=0x20) + _construct = DerNamedBitString(ResetOptionsFlags) class ResetResult(BER_TLV_IE, tag=0x80): - _construct = Enum(Int8ub, ok=0, nothingToDelete=1, undefinedError=127) + _construct = Enum(Int8ub, ok=0, nothingToDelete=1, catBusy=5, undefinedError=127) class EuiccMemoryResetReq(BER_TLV_IE, tag=0xbf34, nested=[ResetOptions]): pass class EuiccMemoryResetResp(BER_TLV_IE, tag=0xbf34, nested=[ResetResult]): diff --git a/tests/unittests/test_euicc.py b/tests/unittests/test_euicc.py index 29c66ea..918d888 100755 --- a/tests/unittests/test_euicc.py +++ b/tests/unittests/test_euicc.py @@ -27,5 +27,38 @@ self.assertEqual(compute_eid_checksum('89049032123451234512345678901299'), '89049032123451234512345678901235') self.assertEqual(compute_eid_checksum(89049032123451234512345678901299), '89049032123451234512345678901235') +class TestResetOptions(unittest.TestCase): + + def test_der_named_bit_string_encodings(self): + cases = ( + ({}, 'bf3403820100'), + ({'deleteOperationalProfiles': True}, 'bf340482020780'), + ({'deleteFieldLoadedTestProfiles': True}, 'bf340482020640'), + ({'resetDefaultSmdpAddress': True}, 'bf340482020520'), + ({'deleteOperationalProfiles': True, + 'deleteFieldLoadedTestProfiles': True}, 'bf3404820206c0'), + ({'deleteOperationalProfiles': True, + 'resetDefaultSmdpAddress': True}, 'bf3404820205a0'), + ({'deleteFieldLoadedTestProfiles': True, + 'resetDefaultSmdpAddress': True}, 'bf340482020560'), + ({'deleteOperationalProfiles': True, + 'deleteFieldLoadedTestProfiles': True, + 'resetDefaultSmdpAddress': True}, 'bf3404820205e0'), + ) + for decoded, expected in cases: + with self.subTest(decoded=decoded): + encoded = EuiccMemoryResetReq(children=[ResetOptions(decoded=decoded)]).to_tlv() + self.assertEqual(encoded.hex(), expected) + parsed = EuiccMemoryResetReq() + parsed.from_tlv(encoded) + actual = parsed.children[0].decoded + for name in ResetOptionsFlags.flags: + self.assertEqual(actual[name], decoded.get(name, False)) + + def test_cat_busy_result(self): + reset = EuiccMemoryResetResp() + reset.from_tlv(bytes.fromhex('bf3403800105')) + self.assertEqual(reset.children[0].decoded, 'catBusy') + if __name__ == "__main__": unittest.main() -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43725?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: I318ea7b08bad9e0b34b14929ef750151f4c5fa4e Gerrit-Change-Number: 43725 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> 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>
1 0
0 0
[S] Change in pysim[master]: saip: fix key usage qualifier of helper created SD keys
by laforge 19 Nov '26

19 Nov '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/43723?usp=email ) Change subject: saip: fix key usage qualifier of helper created SD keys ...................................................................... saip: fix key usage qualifier of helper created SD keys SD_KEY_DEFS holds the GP Key Usage Qualifier as its encoded octet, SecurityDomainKey expects the decoded FlagsEnum dict. Passing the int encoded a 0 qualifier for every newly created key... Change-Id: I4a94562d6052c6796929b81b1f9b9ce5b56dcd20 --- M pySim/esim/saip/personalization.py M tests/unittests/test_esim_saip.py 2 files changed, 19 insertions(+), 1 deletion(-) Approvals: dexter: Looks good to me, approved laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py index 9e5b7fd..8867f4e 100644 --- a/pySim/esim/saip/personalization.py +++ b/pySim/esim/saip/personalization.py @@ -745,10 +745,11 @@ key = pe.find_key(key_version_number=cls.kvn, key_id=cls.key_id) if not key: # Could not find matching key to patch, create a new one + key_usage_qualifier = KeyUsageQualifier.parse(bytes([cls.key_usage_qual])) key = SecurityDomainKey( key_version_number=cls.kvn, key_id=cls.key_id, - key_usage_qualifier=cls.key_usage_qual, + key_usage_qualifier=key_usage_qualifier, key_components=set_components, ) pe.add_key(key) diff --git a/tests/unittests/test_esim_saip.py b/tests/unittests/test_esim_saip.py index 50cb9d5..5d44de3 100755 --- a/tests/unittests/test_esim_saip.py +++ b/tests/unittests/test_esim_saip.py @@ -22,6 +22,7 @@ from pySim.esim.saip import * from pySim.esim.saip import personalization +from pySim.global_platform import KeyUsageQualifier from pprint import pprint as pp @@ -154,6 +155,22 @@ print(f'{get_val2=} {set_val=}') self.assertEqual(get_val2, ({cls.name: set_val},)) + def test_sd_key_personalization_creates_usage_qualifier(self): + """helper created key qualifier must match""" + pes = ProfileElementSequence() + pes.append(ProfileElementHeader()) + pes.append(ProfileElementSD()) + pes.append(ProfileElementEnd()) + + cls = personalization.SdKeyScp02Kvn20AesEnc + cls('00112233445566778899aabbccddeeff').apply(pes) + key = pes.get_pe_for_type('securityDomain').find_key(0x20, 0x01) + self.assertEqual(KeyUsageQualifier.build(key.key_usage_qualifier), b'\x18') + + round_trip = ProfileElementSequence.from_der(pes.to_der()) + key = round_trip.get_pe_for_type('securityDomain').find_key(0x20, 0x01) + self.assertEqual(KeyUsageQualifier.build(key.key_usage_qualifier), b'\x18') + def test_constructor_encode(self): """Test that DER-encoding of PE created by "empty" constructor works without raising exception.""" for cls in [ProfileElementMF, ProfileElementPuk, ProfileElementPin, ProfileElementTelecom, -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43723?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: I4a94562d6052c6796929b81b1f9b9ce5b56dcd20 Gerrit-Change-Number: 43723 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
[XS] Change in docker-playground[master]: redmine: update from 6.1.4 to 6.1.6
by laforge 19 Nov '26

19 Nov '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/44020?usp=email ) Change subject: redmine: update from 6.1.4 to 6.1.6 ...................................................................... redmine: update from 6.1.4 to 6.1.6 Change-Id: Ia0176a37017d6d96b1c4c61e353b0bea3dc181b6 --- M redmine/Dockerfile 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: osmith: Looks good to me, approved fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/redmine/Dockerfile b/redmine/Dockerfile index 5c6ef3e..91aa775 100644 --- a/redmine/Dockerfile +++ b/redmine/Dockerfile @@ -1,4 +1,4 @@ -FROM redmine:6.1.3 +FROM redmine:6.1.6 RUN apt-get update && \ apt-get -y upgrade && \ -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/44020?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: Ia0176a37017d6d96b1c4c61e353b0bea3dc181b6 Gerrit-Change-Number: 44020 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
1 0
0 0
[XS] Change in docker-playground[master]: redmine: update from 6.1.4 to 6.1.6
by osmith 19 Nov '26

19 Nov '26
Attention is currently required from: laforge. osmith has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/docker-playground/+/44020?usp=email ) Change subject: redmine: update from 6.1.4 to 6.1.6 ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/44020?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: Ia0176a37017d6d96b1c4c61e353b0bea3dc181b6 Gerrit-Change-Number: 44020 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Thu, 19 Nov 2026 11:10:17 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in docker-playground[master]: redmine: update from 6.1.4 to 6.1.6
by laforge 19 Nov '26

19 Nov '26
Attention is currently required from: laforge. Hello Jenkins Builder, fixeria, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/docker-playground/+/44020?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder The change is no longer submittable: Verified is unsatisfied now. Change subject: redmine: update from 6.1.4 to 6.1.6 ...................................................................... redmine: update from 6.1.4 to 6.1.6 Change-Id: Ia0176a37017d6d96b1c4c61e353b0bea3dc181b6 --- M redmine/Dockerfile 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/20/44020/2 -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/44020?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: Ia0176a37017d6d96b1c4c61e353b0bea3dc181b6 Gerrit-Change-Number: 44020 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in pysim[master]: global_platform: add tracked security domain selection
by dexter 19 Nov '26

19 Nov '26
Attention is currently required from: Hoernchen. dexter has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43724?usp=email ) Change subject: global_platform: add tracked security domain selection ...................................................................... Patch Set 3: Code-Review+2 (1 comment) Patchset: PS3: I have re-tried this and it works fine. However, I would recommend to add an integration test for this in tests/pySim-shell_test/euicc/ You simply could select the security domains once (the MNO-SD and the ISD-P) and require that there is no exception. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43724?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I7c6dda0f11dc6bb175f05b3832cf49691089c297 Gerrit-Change-Number: 43724 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Comment-Date: Thu, 19 Nov 2026 10:50:00 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in pysim[master]: pySim-shell: verify apdu commands in scripts and -e options up front
by dexter 19 Nov '26

19 Nov '26
Attention is currently required from: Hoernchen. dexter has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43727?usp=email ) Change subject: pySim-shell: verify apdu commands in scripts and -e options up front ...................................................................... Patch Set 2: Code-Review+1 (4 comments) Patchset: PS2: I think its a great idea to implement some validation before we do things. This might prevent a lot of damage and inconsistent state. I haven't fully looked through yet, but my first impression is that the patch looks good. I have left a few cosmetic comments. Unfortunately I have trouble trying it out. As it seems the patch as compatibility issues with some Cmd2 versions? File pySim-shell.py: https://gerrit.osmocom.org/c/pysim/+/43727/comment/a582266d_6e27e9cb?usp=em… : PS2, Line 1112: def verify_startup_apdus(commands: List[tuple]) -> List[str]: maybe call it "verify_apdu_commands"? Technically this utility function could not only be useful to validate APDU commands and scripts that are supplied on startup. In fact it could also be very useful to call it from other locations as well. The bulk_script command for example. https://gerrit.osmocom.org/c/pysim/+/43727/comment/052b22ff_909a48f4?usp=em… : PS2, Line 1130: run_script_parser = cmd2.Cmd._build_run_script_parser() Hmm, when I want to try it, I get this error message: ``` $ ./pySim-shell.py -p 0 Traceback (most recent call last): File "/home/user/work/git_master/pysim/./pySim-shell.py", line 1239, in <module> findings = verify_startup_apdus(startup_commands) File "/home/user/work/git_master/pysim/./pySim-shell.py", line 1130, in verify_startup_apdus run_script_parser = cmd2.Cmd._build_run_script_parser() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: type object 'Cmd' has no attribute '_build_run_script_parser'. Did you mean: 'relative_run_script_parser'? ``` I have cmd2 2.7.0 installed. https://gerrit.osmocom.org/c/pysim/+/43727/comment/27fda88a_38507f18?usp=em… : PS2, Line 1148: def check_line(loc: str, line: str, script_dir: str): I recommend to move this function below check_script, because this is the first and only function the for loop calls. The functions would then be in order. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43727?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ida84b982d7577faa5b37f121599a59bcb2feefec Gerrit-Change-Number: 43727 Gerrit-PatchSet: 2 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Comment-Date: Thu, 19 Nov 2026 10:35:45 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • ...
  • 72
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.