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 -----
  • 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

January 2024

  • 1 participants
  • 1559 discussions
[S] Change in libosmocore[master]: gsm48_ie: fix various issues in doxygen docs
by pespin 08 Jan '24

08 Jan '24
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35496?usp=email ) Change subject: gsm48_ie: fix various issues in doxygen docs ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35496?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id168c5115588b2dbc48605ee0bba13ccc9913bbe Gerrit-Change-Number: 35496 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 08 Jan 2024 09:30:16 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in pysim[master]: Allow logger to do lazy evaluation of format strings
by fixeria 07 Jan '24

07 Jan '24
Attention is currently required from: laforge. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/35495?usp=email ) Change subject: Allow logger to do lazy evaluation of format strings ...................................................................... Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35495?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I39d26cdd5b85a61a06fd8c7a9d0a046e398819bd Gerrit-Change-Number: 35495 Gerrit-PatchSet: 4 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> Gerrit-Comment-Date: Sun, 07 Jan 2024 21:34:55 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in pysim[master]: ts_102_310: Add file definitions resembling ETSI TS 102 310 (EAP)
by laforge 07 Jan '24

07 Jan '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/35486?usp=email ) Change subject: ts_102_310: Add file definitions resembling ETSI TS 102 310 (EAP) ...................................................................... ts_102_310: Add file definitions resembling ETSI TS 102 310 (EAP) The definitions are not used yet, as one would have to add that dynamically based on which EF.DIR entries contain the 0x73 discretionary template. As I don't have any cards implementing this so far, I'll skip that part. Change-Id: I532ff2c94021ab1b4520fe2b6988c8960319d208 --- A pySim/ts_102_310.py 1 file changed, 128 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/pySim/ts_102_310.py b/pySim/ts_102_310.py new file mode 100644 index 0000000..ea3a448 --- /dev/null +++ b/pySim/ts_102_310.py @@ -0,0 +1,114 @@ +# coding=utf-8 +"""Utilities / Functions related to ETSI TS 102 310, the EAP UICC spec. + +(C) 2024 by Harald Welte <laforge(a)osmocom.org> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +""" + +from pySim.construct import * +from construct import * +from construct import Optional as COptional + +#from pySim.utils import * +from pySim.filesystem import CardDF, TransparentEF +from pySim.tlv import BER_TLV_IE, TLV_IE_Collection + +# TS102 310 Section 7.1 +class EF_EAPKEYS(TransparentEF): + class Msk(BER_TLV_IE, tag=0x80): + _construct = HexAdapter(GreedyBytes) + class Emsk(BER_TLV_IE, tag=0x81): + _construct = HexAdapter(GreedyBytes) + class MskCollection(TLV_IE_Collection, nested=[EF_EAPKEYS.Msk, EF_EAPKEYS.Emsk]): + pass + + def __init__(self, fid='4f01', name='EF.EAPKEYS', desc='EAP derived keys'): + super().__init__(fid, sfid=0x01, name=name, desc=desc, size=(1,None)) + self._tlv = EF_EAPKEYS.MskCollection + +# TS 102 310 Section 7.2 +class EF_EAPSTATUS(TransparentEF): + def __init__(self, fid='4f02', name='EF.EAPSTATUS', desc='EAP Authentication Status'): + super().__init__(fid, sfid=0x02, name=name, desc=desc, size=(1,1)) + self._construct = Enum(Int8ub, no_auth_started=0, authenticating=1, + authenticated=2, held_auth_failure=3) + +# TS 102 310 Section 7.3 +class EF_PUId(TransparentEF): + def __init__(self, fid='4f03', name='EF.PUId', desc='Permanent User Identity'): + super().__init__(fid, sfid=0x03, name=name, desc=desc, size=(10,None)) + self._construct = GreedyBytes + +# TS 102 310 Section 7.4 +class EF_Ps(TransparentEF): + def __init__(self, fid='4f04', name='EF.Ps', desc='Pseudonym'): + super().__init__(fid, sfid=0x04, name=name, desc=desc, size=(1,None)) + self._construct = GreedyBytes + +# TS 102 310 Section 7.5 +class EF_CurID(TransparentEF): + def __init__(self, fid='4f20', name='EF.CurID', desc='Current Identity'): + super().__init__(fid, sfid=0x10, name=name, desc=desc, size=(1,None)) + self._construct = Struct('type'/Enum(Int8ub, permanent=0, pseudonym=1, re_authentication=2, should_not_be_revealed=255), + '_len'/Int8ub, + 'value'/Utf8Adapter(this._len)) + + +# TS 102 310 Section 7.6 +class EF_ReID(TransparentEF): + class Identity(BER_TLV_IE, tag=0x80): + _construct = Utf8Adapter(GreedyBytes) + class Counter(BER_TLV_IE, tag=0x81): + _construct = GreedyInteger + class Collection(TLV_IE_Collection, nested=[EF_ReID.Identity, EF_ReID.Counter]): + pass + + def __init__(self, fid='4f21', name='EF.ReID', desc='Re-Authentication Identity'): + super().__init__(fid, sfid=0x11, name=name, desc=desc, size=(1,None)) + self._tlv = EF_ReID.Collection + +# TS 102 310 Section 7.7 +class EF_Realm(TransparentEF): + def __init__(self, fid='4f22', name='EF.Realm', desc='Relm value of the identity'): + super().__init__(fid, sfid=0x12, name=name, desc=desc, size=(1,None)) + self._construct = Struct('_len'/Int8ub, + 'realm'/Utf8Adapter(Bytes(this._len))) + +class DF_EAP(CardDF): + # DF.EAP has no default FID; it always must be discovered via the EF.DIR entry + # and the 0x73 "discretionary template" + def __init__(self, fid, name='DF.EAP', desc='EAP client', **kwargs): + super().__init__(fid=fid, name=name, desc=desc, **kwargs) + files = [ + EF_EAPKEYS(), + EF_EAPSTATUS(), + EF_PUId(), + EF_CurID(), + EF_ReID(), + ] + self.add_files(files) + + +# TS 102 310 Section 5.2 +class EapSupportedTypesList(BER_TLV_IE, tag=0x80): + _construct = GreedyRange(Int8ub) +class EapDedicatedFilesList(BER_TLV_IE, tag=0x81): + _construct = GreedyRange(Int16ub) +class EapLabel(BER_TLV_IE, tag=0x82): + _construct = GreedyBytes +class EapAppSvcSpecData(BER_TLV_IE, tag=0xa0, nested=[EapSupportedTypesList, EapDedicatedFilesList, EapLabel]): + pass +class DiscretionaryTemplate(BER_TLV_IE, tag=0x73, nested=[EapAppSvcSpecData]): + pass -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35486?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I532ff2c94021ab1b4520fe2b6988c8960319d208 Gerrit-Change-Number: 35486 Gerrit-PatchSet: 4 Gerrit-Owner: laforge <laforge(a)osmocom.org> 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> Gerrit-MessageType: merged
1 0
0 0
[L] Change in pysim[master]: Add pySim.esim.bsp module implementing BSP (BPP Protection Protocol)
by laforge 07 Jan '24

07 Jan '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/35488?usp=email ) Change subject: Add pySim.esim.bsp module implementing BSP (BPP Protection Protocol) ...................................................................... Add pySim.esim.bsp module implementing BSP (BPP Protection Protocol) This is the protocol used for the ES8+ interface between SM-DP+ and the eUICC in the GSMA eSIM system. Change-Id: Ic461936f2e68e1e6f7faab33d06acf3063e261e7 --- A pySim/esim/__init__.py A pySim/esim/bsp.py M requirements.txt A tests/test_esim_bsp.py 4 files changed, 382 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/pySim/esim/__init__.py b/pySim/esim/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/pySim/esim/__init__.py diff --git a/pySim/esim/bsp.py b/pySim/esim/bsp.py new file mode 100644 index 0000000..cf2104a --- /dev/null +++ b/pySim/esim/bsp.py @@ -0,0 +1,297 @@ +# Early proof-of-concept implementation of +# GSMA eSIM RSP (Remote SIM Provisioning BSP (BPP Protection Protocol), +# where BPP is the Bound Profile Package. So the full expansion is the +# "GSMA eSIM Remote SIM Provisioning Bound Profile Packate Protection Protocol" +# +# Originally (SGP.22 v2.x) this was called SCP03t, but it has since been +# renamed to BSP. +# +# (C) 2023 by Harald Welte <laforge(a)osmocom.org> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# SGP.22 v3.0 Section 2.5.3: +# That block of data is split into segments of a maximum size of 1020 bytes (including the tag, length field and MAC). +MAX_SEGMENT_SIZE = 1020 + +import abc +from typing import List +import logging + +# for BSP key derivation +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.kdf.x963kdf import X963KDF + +from Cryptodome.Cipher import AES +from Cryptodome.Hash import CMAC + +from pySim.utils import bertlv_encode_len, bertlv_parse_one, b2h + +# don't log by default +logger = logging.getLogger(__name__) +logger.addHandler(logging.NullHandler()) + +class BspAlgo(abc.ABC): + blocksize: int + + def _get_padding(self, in_len: int, multiple: int, padding: int = 0) -> bytes: + """Return padding bytes towards multiple of N.""" + if in_len % multiple == 0: + return b'' + pad_cnt = multiple - (in_len % multiple) + return b'\x00' * pad_cnt + + def _pad_to_multiple(self, indat: bytes, multiple: int, padding: int = 0) -> bytes: + """Pad the input data to multiples of 'multiple'.""" + return indat + self._get_padding(len(indat), self.blocksize, padding) + + def __str__(self): + return self.__class__.__name__ + +class BspAlgoCrypt(BspAlgo, abc.ABC): + + def __init__(self, s_enc: bytes): + self.s_enc = s_enc + self.block_nr = 1 + + def encrypt(self, data:bytes) -> bytes: + """Encrypt given input bytes using the key material given in constructor.""" + padded_data = self._pad_to_multiple(data, self.blocksize) + block_nr = self.block_nr + ciphertext = self._encrypt(padded_data) + logger.debug("encrypt(block_nr=%u, s_enc=%s, plaintext=%s, padded=%s) -> %s", + block_nr, b2h(self.s_enc), b2h(data), b2h(padded_data), b2h(ciphertext)) + return ciphertext + + def decrypt(self, data:bytes) -> bytes: + """Decrypt given input bytes using the key material given in constructor.""" + return self._unpad(self._decrypt(data)) + + @abc.abstractmethod + def _unpad(self, padded: bytes) -> bytes: + """Remove the padding from padded data.""" + pass + + @abc.abstractmethod + def _encrypt(self, data:bytes) -> bytes: + """Actual implementation, to be implemented by derived class.""" + pass + + @abc.abstractmethod + def _decrypt(self, data:bytes) -> bytes: + """Actual implementation, to be implemented by derived class.""" + pass + +class BspAlgoCryptAES128(BspAlgoCrypt): + name = 'AES-CBC-128' + blocksize = 16 + + def _get_padding(self, in_len: int, multiple: int, padding: int = 0): + # SGP.22 section 2.6.4.4 + # Append a byte with value '80' to the right of the data block; + # Append 0 to 15 bytes with value '00' so that the length of the padded data block + # is a multiple of 16 bytes. + return b'\x80' + super()._get_padding(in_len + 1, multiple, padding) + + def _unpad(self, padded: bytes) -> bytes: + """Remove the customary 80 00 00 ... padding used for AES.""" + # first remove any trailing zero bytes + stripped = padded.rstrip(b'\0') + # then remove the final 80 + assert stripped[-1] == 0x80 + return stripped[:-1] + + def _get_icv(self): + # The binary value of this number SHALL be left padded with zeroes to form a full block. + data = self.block_nr.to_bytes(self.blocksize, "big") + #iv = bytes([0] * (self.blocksize-1)) + b'\x01' + iv = bytes([0] * self.blocksize) + # This block SHALL be encrypted with S-ENC to produce the ICV for command encryption. + cipher = AES.new(self.s_enc, AES.MODE_CBC, iv) + icv = cipher.encrypt(data) + logger.debug("_get_icv(block_nr=%u, data=%s) -> icv=%s", self.block_nr, b2h(data), b2h(icv)) + self.block_nr = self.block_nr + 1 + return icv + + def _encrypt(self, data: bytes) -> bytes: + cipher = AES.new(self.s_enc, AES.MODE_CBC, self._get_icv()) + return cipher.encrypt(data) + + def _decrypt(self, data: bytes) -> bytes: + cipher = AES.new(self.s_enc, AES.MODE_CBC, self._get_icv()) + return cipher.decrypt(data) + + +class BspAlgoMac(BspAlgo, abc.ABC): + l_mac = 0 # must be overridden by derived class + + def __init__(self, s_mac: bytes, initial_mac_chaining_value: bytes): + self.s_mac = s_mac + self.mac_chain = initial_mac_chaining_value + + def auth(self, tag: int, data: bytes) -> bytes: + assert tag in range (256) + # The input data used for C-MAC computation comprises the MAC Chaining value, the tag, the final length and the result of step 2 + lcc = len(data) + self.l_mac + tag_and_length = bytes([tag]) + bertlv_encode_len(lcc) + temp_data = self.mac_chain + tag_and_length + data + old_mcv = self.mac_chain + c_mac = self._auth(temp_data) + # The output data is computed by concatenating the following data: the tag, the final length, the result of step 2 and the C-MAC value. + ret = tag_and_length + data + c_mac + logger.debug("auth(tag=0x%x, mcv=%s, s_mac=%s, plaintext=%s, temp=%s) -> %s", + tag, b2h(old_mcv), b2h(self.s_mac), b2h(data), b2h(temp_data), b2h(ret)) + return ret + + def verify(self, ciphertext: bytes) -> bool: + mac_stripped = ciphertext[0:-self.l_mac] + mac_received = ciphertext[-self.l_mac:] + temp_data = self.mac_chain + mac_stripped + mac_computed = self._auth(temp_data) + if mac_received != mac_computed: + raise ValueError("MAC value not matching: received: %s, computed: %s" % (mac_received, mac_computed)) + return mac_stripped + + @abc.abstractmethod + def _auth(self, temp_data: bytes) -> bytes: + """To be implemented by algorithm specific derived class.""" + pass + +class BspAlgoMacAES128(BspAlgoMac): + name = 'AES-CMAC-128' + l_mac = 8 + + def _auth(self, temp_data: bytes) -> bytes: + # The full MAC value is computed using the MACing algorithm as defined in table 4c. + cmac = CMAC.new(self.s_mac, ciphermod=AES) + cmac.update(temp_data) + full_c_mac = cmac.digest() + # Subsequent MAC chaining values are the full result of step 4 of the previous data block + self.mac_chain = full_c_mac + # If the algorithm is AES-CBC-128 or SM4-CBC, the C-MAC value is the 8 most significant bytes of the result of step 4 + return full_c_mac[0:8] + + + +def bsp_key_derivation(shared_secret: bytes, key_type: int, key_length: int, host_id: bytes, eid, l : int = 16): + """BSP protocol key derivation as per SGP.22 v3.0 Section 2.6.4.2""" + assert key_type <= 255 + assert key_length <= 255 + + host_id_lv = bertlv_encode_len(len(host_id)) + host_id + eid_lv = bertlv_encode_len(len(eid)) + eid + shared_info = bytes([key_type, key_length]) + host_id_lv + eid_lv + logger.debug("kdf_shared_info: %s", b2h(shared_info)) + + # X9.63 Key Derivation Function with SHA256 + xkdf = X963KDF(algorithm=hashes.SHA256(), length=l*3, sharedinfo=shared_info) + out = xkdf.derive(shared_secret) + logger.debug("kdf_out: %s", b2h(out)) + + initial_mac_chaining_value = out[0:l] + s_enc = out[l:2*l] + s_mac = out[l*2:3*l] + + return s_enc, s_mac, initial_mac_chaining_value + + + +class BspInstance: + """An instance of the BSP crypto. Initialized once with the key material via constructor, + then the user can call any number of encrypt_and_mac cycles to protect plaintext and + generate the respective ciphertext.""" + def __init__(self, s_enc: bytes, s_mac: bytes, initial_mcv: bytes): + logger.debug("%s(s_enc=%s, s_mac=%s, initial_mcv=%s)", self.__class__.__name__, b2h(s_enc), b2h(s_mac), b2h(initial_mcv)) + self.c_algo = BspAlgoCryptAES128(s_enc) + self.m_algo = BspAlgoMacAES128(s_mac, initial_mcv) + + TAG_LEN = 1 + length_len = len(bertlv_encode_len(MAX_SEGMENT_SIZE)) + self.max_payload_size = MAX_SEGMENT_SIZE - TAG_LEN - length_len - self.m_algo.l_mac + + @classmethod + def from_kdf(cls, shared_secret: bytes, key_type: int, key_length: int, host_id: bytes, eid: bytes): + """Convenience constructor for constructing an instance with keys from KDF.""" + s_enc, s_mac, initial_mcv = bsp_key_derivation(shared_secret, key_type, key_length, host_id, eid) + return cls(s_enc, s_mac, initial_mcv) + + def encrypt_and_mac_one(self, tag: int, plaintext:bytes) -> bytes: + """Encrypt + MAC a single plaintext TLV. Returns the protected ciphertex.""" + assert tag <= 255 + assert len(plaintext) <= self.max_payload_size + logger.debug("encrypt_and_mac_one(tag=0x%x, plaintext=%s)", tag, b2h(plaintext)) + ciphered = self.c_algo.encrypt(plaintext) + maced = self.m_algo.auth(tag, ciphered) + return maced + + def encrypt_and_mac(self, tag: int, plaintext:bytes) -> List[bytes]: + remainder = plaintext + result = [] + while len(remainder): + remaining_len = len(remainder) + if remaining_len < self.max_payload_size: + segment_len = remaining_len + segment = remainder + remainder = b'' + else: + segment_len = self.max_payload_size + segment = remainder[0:segment_len] + remainder = remainder[segment_len:] + result.append(self.encrypt_and_mac_one(tag, segment)) + return result + + def mac_only_one(self, tag: int, plaintext: bytes) -> bytes: + """MAC a single plaintext TLV. Returns the protected ciphertex.""" + assert tag <= 255 + assert len(plaintext) < self.max_payload_size + maced = self.m_algo.auth(tag, plaintext) + # The data block counter for ICV caluclation is incremented also for each segment with C-MAC only. + self.c_algo.block_nr += 1 + return maced + + def mac_only(self, tag: int, plaintext:bytes) -> List[bytes]: + remainder = plaintext + result = [] + while len(remainder): + remaining_len = len(remainder) + if remaining_len < self.max_payload_size: + segment_len = remaining_len + segment = remainder + remainder = b'' + else: + segment_len = self.max_payload_size + segment = remainder[0:segment_len] + remainder = remainder[segment_len:] + result.append(self.mac_only_one(tag, segment)) + return result + + def demac_and_decrypt_one(self, ciphertext: bytes) -> bytes: + payload = self.m_algo.verify(ciphertext) + tdict, l, val, remain = bertlv_parse_one(payload) + logger.debug("tag=%s, l=%u, val=%s, remain=%s", tdict, l, b2h(val), b2h(remain)) + plaintext = self.c_algo.decrypt(val) + return plaintext + + def demac_and_decrypt(self, ciphertext_list: List[bytes]) -> bytes: + plaintext_list = [self.demac_and_decrypt_one(x) for x in ciphertext_list] + return b''.join(plaintext_list) + + def demac_only_one(self, ciphertext: bytes) -> bytes: + payload = self.m_algo.verify(ciphertext) + tdict, l, val, remain = bertlv_parse_one(payload) + return val + + def demac_only(self, ciphertext_list: List[bytes]) -> bytes: + plaintext_list = [self.demac_only_one(x) for x in ciphertext_list] + return b''.join(plaintext_list) diff --git a/requirements.txt b/requirements.txt index 4332b66..f17e293 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,5 +10,6 @@ termcolor colorlog pycryptodomex +cryptography packaging git+https://github.com/hologram-io/smpp.pdu diff --git a/tests/test_esim_bsp.py b/tests/test_esim_bsp.py new file mode 100755 index 0000000..650b1fd --- /dev/null +++ b/tests/test_esim_bsp.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 + +# (C) 2023-2024 by Harald Welte <laforge(a)osmocom.org> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import unittest +import logging +import base64 + +from pySim.utils import b2h, h2b +from pySim.esim.bsp import * + +class BSP_Test(unittest.TestCase): + shared_secret = h2b('8902dca391bbb22570fe60c176076246f568b1941265dff1d729e63039658089') + eid_bin = h2b('89049032123451234512345678901335') + def test_kdf(self): + s_enc, s_mac, icv = bsp_key_derivation(self.shared_secret, 0x88, 16, b'\x80'*8, self.eid_bin) + self.assertEqual(s_enc, h2b('d782d575b22a38334556a3d9a1e2ae6b')) + self.assertEqual(s_mac, h2b('a35addc192ae8f934e2932116c7e89e7')) + self.assertEqual(icv, h2b('734bc93ddb10c71c5ad13d420dc08b5b')) + +class BSP_Test_mode51(unittest.TestCase): + """This test was created using hex-dumps from a log/trace of a 3rd party SM-DP+. We therefore use these + test vectors to verify our implementation is in agreement with that other implementation.""" + shared_secret = h2b('c9a993dd4879a8f7161f2085410edd4f9652f1df37be097ba96ba2ca6be528fe') + eid_bin = h2b('89049032123451234512345678901235') + + def test_kdf(self): + s_enc, s_mac, icv = bsp_key_derivation(self.shared_secret, 0x88, 16, b'\x80'*8, self.eid_bin) + self.assertEqual(s_enc, h2b('472f5bfadd97f21d34f3ce9b51b92751')) + self.assertEqual(s_mac, h2b('9ec07f5b36a13e12a991d66e294e6242')) + self.assertEqual(icv, h2b('406d507b448a699e7a36a38494debbde')) + + def test_ciphering(self): + bi = BspInstance(h2b('472f5bfadd97f21d34f3ce9b51b92751'), h2b('9ec07f5b36a13e12a991d66e294e6242'), h2b('406d507b448a699e7a36a38494debbde')) + output = bi.encrypt_and_mac(0x87, h2b('bf2400')) + self.assertEqual(output[0], h2b('8718f6fe031e4b9cfe87c8e1e62f3fde85c49412d7722a6a2d89')) + + output = bi.mac_only(0x88, h2b('bf252d5a0a98001032547698103214910947534d415f54455354921147534d415f544553545f50524f46494c45950100')) + self.assertEqual(output[0], h2b('8838bf252d5a0a98001032547698103214910947534d415f54455354921147534d415f544553545f50524f46494c459501008a62cc9adbb5ccbc')) + + output = bi.encrypt_and_mac(0x87, h2b('bf26368010000102030405060708090a0b0c0d0e0f8110010102030405060708090a0b0c0d0e0f8210020102030405060708090a0b0c0d0e0f')) + self.assertEqual(output[0], h2b('8748a14c800a001992351cd46ad2945654674369701d82b7b46567652bc8fbed234939fc57fba748015525fd6c651e9d3d1330652d42a0cfad950e912122af4ec5362d3c0bc535729c40')) + + # new key material after replaceSessionKeys + bi = BspInstance(b'\x01\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f', + b'\x02\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f', + b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f') + + segment0 = h2b('a048800102810101821a53494d616c6c69616e63652053616d706c652050726f66696c65830a89000123456789012341a506810084008b00a610060667810f010201060667810f010204b08201f8a0058000810101810667810f010201a207a105c60301020aa305a1038b010fa40c830a98001032547698103214a527a109820442210026800198831a61184f10a0000000871002ff33ff01890000010050045553494da682019ea10a8204422100258002022b831b8001019000800102a406830101950108800158a40683010a95010882010a8316800101a40683010195010880015aa40683010a95010882010f830b80015ba40683010a95010882011a830a800101900080015a970082011b8316800103a406830101950108800158a40683010a95010882010f8316800111a40683010195010880014aa40683010a95010882010f8321800103a406830101950108800158a40683010a950108840132a4068301019501088201048321800101a406830101950108800102a406830181950108800158a40683010a950108820104831b800101900080011aa406830101950108800140a40683010a95010882010a8310800101900080015aa40683010a95010882011583158001019000800118a40683010a95010880014297008201108310800101a40683010195010880015a97008201158316800113a406830101950108800148a40683010a95010882010f830b80015ea40683010a95010882011a83258001019000800102a010a406830101950108a406830102950108800158a40683010a950108a33fa0058000810102a13630118001018108303030303030303082020099300d800102810831323334353637383012800200818108313233343536373882020088a241a0058000810103a138a0363010800101810831323334ffffffff8201013010800102810830303030ffffffff820102301080010a810835363738ffffffff830101a182029ea0058000810104a18202933082028f62228202782183027ff18410a0000000871002ff33ff0189000001008b010ac60301810a62118202412183026f078b01028001098801388109082943019134876765621482044221002583026f068b010a8801b8c7022f06621a8202412183026f088b0105800121880140a507c00180c10207ff621a8202412183026f098b0105800121880148a507c00180c10207ff62168202412183026f318b0102800101880190a503c1010a62118202412183026f388b010280010e880120810d0a2e178ce73204000000000000621982044221001a83026f3b8b0108800202088800a504c10200ff62198204422100b083026f3c8b0105800206e08800a504c10200ff621282044221002683026f428b0105800126') + output = bi.encrypt_and_mac_one(0x86, segment0) + self.assertEqual(output, h2b('868203f80fd36b066b43e53906b33263c4141d18036fcac7bde47faed79e76514d39f1f405d9785ff04badf379a96bcf4685eb861239da34eeb213d0cd1e0d85e96e36097a52f600907e08b6f01232eb3792a00cc6b3288cc832c7f30357edfe0818d1f39ad8d55b5bd5d9c65917d0d16ee7e1421a44453714d66209bf441425bf6d153a85ba7e7406d58a4c46fb930bb14eefd6a853434619805429cbbb003bd5a56e7bceaf4666eb352ad46f47ea572c6ad311683803db3bec4d783583858f2ecfbaec3ed780fb3e3a645b1bf5cfd1047e5862c4a8877382dabd6aef6fa72ec6378ce7b21502d3267514b29bd589703ee7bd5b1e6d868b6b7c55006bc32406a924f44bfdb6c801d490450a54633bbd66bb0ece8b3a9be09433c537f3e3b2b8e45833365a94479b1895e9ba13387fca116565c267b6bc1274c82510b21ac9fa77574412351468fd1eac8928c9494e5eb8a909d9372476c62e8a2b556b557a79cdb47503ba5d9fd86d1962c23b3289f37df9a05668957df34c37806359af1d8dfecedf9bbf4888be9753f2b449ce4e5cde510572f9be4fb506f329a848c4583ac9ac710e53d512ad504f2e3769c2911c34f84ad0622c5428446d1e9c59bb6b2029f231b05ef45d3ec60fceff121ba684a023037b753f855e1067b8ad02783c04eb81ba47fcec0947bbc9661d90c6f00c0f4e6f9c22e0b25905379f8b265b436a4a74253a64c5734f956d134cf5b6c0671125b20b735f405fee1fc1941ed141734fa6856e898dc655fb91b045b3797d14b97a68ed3480ec137565d6c4d007f95ee705d452d0344ce9e9bbd0712f399ef8604f3f472b403ea64f00c969fd30a012cb8be049c54556994117fc5f6043930107774910be5f47c780427de063a56d45400a814c86dfcc2465262baf273a6ca89e77bb8c73efe2d22d975516b80c648404b10d3f329776a21251bedf445ade24b656e8635f0d7fe39772d942d9432766efb5152c6e990123c52744f1c402962a381ff2aaddaa1bd522a9b65a229f9adcd4099475b3f9ba45161ee35206365181e1d69d263d8d27444a7c3a2d7ddbb398ac5affea28cb0373057dad7741e52adb95822fee5157ce3c0ad978c5231a219ca0726d50eeb0c69d579094a54820194aeef13a365d85c52257f51cb65c567e0cdf1ce38b80eaa4d131ab7086e303c5728cf41a25df954d60ac12400d2a2990e67dbeff866736937beb8fce526be1dd5dc5d77d00b8783b34691a3e9bda7e697eec4cfa70b25914795af23ec6d258530f71402b9230947dc99f9140b16a54ba1291f54ef736de6711c1ae074b627dfc2fc5d5250f812b7ecd1d0f5020a3acf20ad5759cd9e761ce21882977f7db66aaba2d8f5190f6f23996af14b670ccac066c93af06a41f19d9ee712ce13fbe73b99e55401b208b991c8ced12d34c')) + + segment1 = h2b('880062158202412183026f438b01058001028800a503c0018062128202412183026f468b036f060a8001118800810c0253494d616c6c69616e636562118202412183026f568b0108800101880128810100621b8202412183026f5b8b0105800106880178a508c00180c203f0000062168202412183026f5c8b0102800103880180a503c0018062168202412183026f738b010580010e880160a503c00180020107810700f1100000ff0162118202412183026f788b01028001028801308102004062118202412183026f7b8b010580010c88016862168202412183026f7e8b010580010b880158a503c0018002010781040000ff0162168202412183026fad8b010a800104880118a503c10100020103810102621382044221000483026fb78b010a800104880108810419f1ff0162158202412183026fc48b01058001808800a503c0018062168202412183026fe38b01058001128801f0a503c0018002010f810300000162168202412183026fe48b01058001508801c0a503c00180a225a0058000810105a11ca01a301880020081810831323334ffffffff82020081830101840122a43aa0058000810106a131a12f8001018101018210000102030405060708090a0b0c0d0e0f83100102030405060708090a0b0c0d0e0f008603010203a681bba0058000810107a1444f07a00000015153504f08a0000001515350414f08a000000151000000820382dc0083010fc90a810280008201f08701f0ea11800f0100000100000002011203b2010000a26c3022950138820101830101301730158001808610112233445566778899aabbccddeeff103022950134820102830101301730158001808610112233445566778899aabbccddeeff1030229501c8820103830101301730158001808610112233445566778899aabbccddeeff10a681c0a0058000810108a1494f07a00000015153504f08a0000001515350414f10a00000055910100102736456616c7565820380800083010fc907810280008201f0ea11800f01000001000000020112036c756500a26c30229501388201018301013017301580018086108811223344556677881122334455667730229501348201028301013017301580018086108811223344556677881122334455667730229501c882010383010130173015800180861088112233445566778811223344556677a8820263a0058000810109a18202184f08a000000559101001c482020a01002edecaffed020204000108a0000005591010011b636f6d2f67736d612f65756963632f746573742f6170706c657431020021002e0021000f003b002a00210066000a000e0000008a040f00000000000004010004003b04030107a0000000620101000110a0000000090005ffffffff') + output = bi.encrypt_and_mac_one(0x86, segment1) + self.assertEqual(output, h2b('868203f8648e034ae0dc4ce022ee1e60b130dda95e13b21b0da3de7677677f47900c1beb3637b8aa35f3a9e096c0285ffe3e931983df900b36b7e6bc4b9af14b0ee3d49637eb2d4cff314b5d00789a751dfd9554651fb2b7c66ad4e22a794d5b88cb71ccf4c05d53abeba8bd3b0c8209346f014cbdee62be4878e3fea09a96007135a6c584aa843c48972842bdbece1c439723021b3f0d535d557995beedbd2b56f416148df90cb1a4d2fa26288801d56a2cbb0a404f2fd9a73042d7a3486bfb7256c1d274aae5b7ec24e8eba28b7dce69edc44189b24186b98397b4a74831f8ab46e8e46a2ed3077d4924f5d3f6e4c1de5ddffd194e7f0f97d94ea2801d1364835c9871bae6539e3e1355c5970711d845864f04d9c1dccac0d4068dcf4664e9976509fe43fec6beb3ddc96839aba6d89bb1593c5b6ebbc32fff39c4a5bb3e5c9df6a1abc05818dbd5149733381e69521066e1bbd648eb19b00602767e90beaeb3b3b92679940a603c0500e37892d7b4fa44355c3deec8af207f89d04f83cd88603e9cb9c96f74643816e87af85a8a9d0283cdf535d1fbaefb930fd4a0dba2ae30ee9d2d9e2a31827a012a6380af42ac87f3bfd7079ddd8fa27d2299fb4d5879e9a17a5062e13cab4f7bed22ed54932fa53d630bca8592f957a7ed148e9d4f28075c2565a550694b876091a1181ba512e70fde4f28ae6968a18d721396c0fee9cd7744dee90bf85f5adddb3417b3ede9ea3cfd5eae2d820b17600ce3b95f6df38a5bc39302c5155c3f241ddfc7cee527af7f6a67868a577c39e76e26c4ed5d6aca031a97c280da27ae8de20e57a1dbab40a31e96e054f9a6f50578fd00156e37b70eead71af3258075c1ba84282aea462553504a868443b301ed99dcd5f414b720ef67cf5c4d16f1f7b9df741c2343246dcb717f3fa62b633539bdcc0082d161499caad8d097be78133dafd19777559f77c6d7a8f61323ff660613aa47cee26a4f7515204eee3c7eaa00eb55529b0ddae3436ec679fc591fe2063de94db00b5d0f041beeb80a91f108f7cf4b3b1344b0fbb437630ee437b4c7744c54009a59a9099681f3a3fa386f294c0eb4562581202a369772833efdc6e840695352de3864671e7fb0fd081ec162a2a62ea5b8a9da837f3920b4196fbe2ec912ade440537ae4a07dfc115c9c030539f278e0801bda4f15298ba50e329b18992af8b899686ec97175509d4a217d2eba8feef5f5732fc7be86370f7723896b784bd45517af86a7521e952b6be924d91a5190e3c2c65ce8924df43ddb25c529dde324a722a156df459f4b38bb062975fad9fadd27f6425e422b1abd9a7259f0bd712a486e1aa25ca848cf65c5fb888bf61ae136b68cf55cb643c198537cd83df0dbb842c5f4982ca3088cc2d8e867c3049a84b515ec39b0b774a8482099327006acff')) + + +if __name__ == "__main__": + unittest.main() -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35488?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ic461936f2e68e1e6f7faab33d06acf3063e261e7 Gerrit-Change-Number: 35488 Gerrit-PatchSet: 5 Gerrit-Owner: laforge <laforge(a)osmocom.org> 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> Gerrit-MessageType: merged
1 0
0 0
[XL] Change in pysim[master]: Initial proof-of-concept SM-DP+ for GSMA consumer eSIM RSP
by Jenkins Builder 07 Jan '24

07 Jan '24
Attention is currently required from: dexter, fixeria, lynxis lazus. Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/35461?usp=email ) Change subject: Initial proof-of-concept SM-DP+ for GSMA consumer eSIM RSP ...................................................................... Patch Set 10: (1 comment) File docs/osmo-smdpp.rst: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-13488): https://gerrit.osmocom.org/c/pysim/+/35461/comment/0a44c5aa_03117f5a PS10, Line 7: At least at this point, it is intended to be used for reasearch and development, and not as a 'reasearch' may be misspelled - perhaps 'research'? -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35461?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I6232847432dc6920cd2bd08c84d7099c29ca1c11 Gerrit-Change-Number: 35461 Gerrit-PatchSet: 10 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Sun, 07 Jan 2024 19:42:19 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[L] Change in pysim[master]: Add pySim.esim.bsp module implementing BSP (BPP Protection Protocol)
by laforge 07 Jan '24

07 Jan '24
Attention is currently required from: dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/35488?usp=email ) Change subject: Add pySim.esim.bsp module implementing BSP (BPP Protection Protocol) ...................................................................... Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35488?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ic461936f2e68e1e6f7faab33d06acf3063e261e7 Gerrit-Change-Number: 35488 Gerrit-PatchSet: 5 Gerrit-Owner: laforge <laforge(a)osmocom.org> 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> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Sun, 07 Jan 2024 19:42:17 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in pysim[master]: ts_102_310: Add file definitions resembling ETSI TS 102 310 (EAP)
by laforge 07 Jan '24

07 Jan '24
Attention is currently required from: dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/35486?usp=email ) Change subject: ts_102_310: Add file definitions resembling ETSI TS 102 310 (EAP) ...................................................................... Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35486?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I532ff2c94021ab1b4520fe2b6988c8960319d208 Gerrit-Change-Number: 35486 Gerrit-PatchSet: 4 Gerrit-Owner: laforge <laforge(a)osmocom.org> 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> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Sun, 07 Jan 2024 19:42:07 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[XL] Change in pysim[master]: Initial proof-of-concept SM-DP+ for GSMA consumer eSIM RSP
by laforge 07 Jan '24

07 Jan '24
Attention is currently required from: dexter, fixeria, lynxis lazus. Hello Jenkins Builder, dexter, fixeria, lynxis lazus, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/35461?usp=email to look at the new patch set (#10). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: Initial proof-of-concept SM-DP+ for GSMA consumer eSIM RSP ...................................................................... Initial proof-of-concept SM-DP+ for GSMA consumer eSIM RSP This commit introduces * the osmo-smdpp.py program implementing the main procedures and the HTTP/REST based ES9+ * python modules for ES8+ and non-volatile RSP Session State storage * the ASN.1 source files required to parse/encode RSP * 3GPP test certificates from SGP.26 * an unsigned profile package (UPP) of a SAIP v2.3 TS48 test profile As I couldn't get the 'Klein' tls support to work, the SM-DP+ code currently does not support HTTPS/TLS but plan HTTP, so you either have to modify your LPA to use HTTP instead of HTTPS, or put a TLS proxy in front. I have successfully installed an eSIM profile on a test eUICC that contains certificate/key data within the test CI defined in GSMA SGP.26 Change-Id: I6232847432dc6920cd2bd08c84d7099c29ca1c11 --- A .checkpatch.conf M docs/index.rst A docs/osmo-smdpp.rst A osmo-smdpp.py M pySim/esim/__init__.py A pySim/esim/asn1/rsp/PKIX1Explicit88.asn A pySim/esim/asn1/rsp/PKIX1Implicit88.asn A pySim/esim/asn1/rsp/rsp.asn A pySim/esim/es8p.py A pySim/esim/rsp.py M requirements.txt A smdpp-data/certs/CertificateIssuer/CERT_CI_ECDSA_BRP.der A smdpp-data/certs/CertificateIssuer/CERT_CI_ECDSA_BRP.pem A smdpp-data/certs/CertificateIssuer/CERT_CI_ECDSA_NIST.der A smdpp-data/certs/CertificateIssuer/CERT_CI_ECDSA_NIST.pem A smdpp-data/certs/CertificateIssuer/CI-csr.cnf A smdpp-data/certs/DPauth/CERT_S_SM_DP2auth_ECDSA_BRP.der A smdpp-data/certs/DPauth/CERT_S_SM_DP2auth_ECDSA_NIST.der A smdpp-data/certs/DPauth/CERT_S_SM_DPauth_ECDSA_BRP.der A smdpp-data/certs/DPauth/CERT_S_SM_DPauth_ECDSA_NIST.der A smdpp-data/certs/DPauth/PK_S_SM_DP2auth_ECDSA_BRP.pem A smdpp-data/certs/DPauth/PK_S_SM_DP2auth_ECDSA_NIST.pem A smdpp-data/certs/DPauth/PK_S_SM_DPauth_ECDSA_BRP.pem A smdpp-data/certs/DPauth/PK_S_SM_DPauth_ECDSA_NIST.pem A smdpp-data/certs/DPauth/SK_S_SM_DP2auth_ECDSA_BRP.pem A smdpp-data/certs/DPauth/SK_S_SM_DP2auth_ECDSA_NIST.pem A smdpp-data/certs/DPauth/SK_S_SM_DPauth_ECDSA_BRP.pem A smdpp-data/certs/DPauth/SK_S_SM_DPauth_ECDSA_NIST.pem A smdpp-data/certs/DPauth/data_sig.der A smdpp-data/certs/DPpb/CERT_S_SM_DP2pb_ECDSA_BRP.der A smdpp-data/certs/DPpb/CERT_S_SM_DP2pb_ECDSA_NIST.der A smdpp-data/certs/DPpb/CERT_S_SM_DPpb_ECDSA_BRP.der A smdpp-data/certs/DPpb/CERT_S_SM_DPpb_ECDSA_NIST.der A smdpp-data/certs/DPpb/PK_S_SM_DP2pb_ECDSA_BRP.pem A smdpp-data/certs/DPpb/PK_S_SM_DP2pb_ECDSA_NIST.pem A smdpp-data/certs/DPpb/PK_S_SM_DPpb_ECDSA_BRP.pem A smdpp-data/certs/DPpb/PK_S_SM_DPpb_ECDSA_NIST.pem A smdpp-data/certs/DPpb/SK_S_SM_DP2pb_ECDSA_BRP.pem A smdpp-data/certs/DPpb/SK_S_SM_DP2pb_ECDSA_NIST.pem A smdpp-data/certs/DPpb/SK_S_SM_DPpb_ECDSA_BRP.pem A smdpp-data/certs/DPpb/SK_S_SM_DPpb_ECDSA_NIST.pem A smdpp-data/certs/DPtls/CERT_S_SM_DP2_TLS.csr.cnf A smdpp-data/certs/DPtls/CERT_S_SM_DP2_TLS.der A smdpp-data/certs/DPtls/CERT_S_SM_DP2_TLS.ext.cnf A smdpp-data/certs/DPtls/CERT_S_SM_DP4_TLS.csr.cnf A smdpp-data/certs/DPtls/CERT_S_SM_DP4_TLS.der A smdpp-data/certs/DPtls/CERT_S_SM_DP4_TLS.ext.cnf A smdpp-data/certs/DPtls/CERT_S_SM_DP8_TLS.csr.cnf A smdpp-data/certs/DPtls/CERT_S_SM_DP8_TLS.der A smdpp-data/certs/DPtls/CERT_S_SM_DP8_TLS.ext.cnf A smdpp-data/certs/DPtls/CERT_S_SM_DP_TLS.csr.cnf A smdpp-data/certs/DPtls/CERT_S_SM_DP_TLS.ext.cnf A smdpp-data/certs/DPtls/CERT_S_SM_DP_TLS_BRP.der A smdpp-data/certs/DPtls/CERT_S_SM_DP_TLS_NIST.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2021/CERT_S_SM_DP2_TLS.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2021/CERT_S_SM_DP4_TLS.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2021/CERT_S_SM_DP8_TLS.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2021/CERT_S_SM_DP_TLS_BRP.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2021/CERT_S_SM_DP_TLS_NIST.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2022/CERT_S_SM_DP2_TLS.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2022/CERT_S_SM_DP4_TLS.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2022/CERT_S_SM_DP8_TLS.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2022/CERT_S_SM_DP_TLS_BRP.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2022/CERT_S_SM_DP_TLS_NIST.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2023/CERT_S_SM_DP2_TLS.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2023/CERT_S_SM_DP4_TLS.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2023/CERT_S_SM_DP8_TLS.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2023/CERT_S_SM_DP_TLS_BRP.der A smdpp-data/certs/DPtls/Old_TLS_Validity/Expired 2023/CERT_S_SM_DP_TLS_NIST.der A smdpp-data/certs/DPtls/PK_S_SM_DP2_TLS_NIST.pem A smdpp-data/certs/DPtls/PK_S_SM_DP4_TLS.pem A smdpp-data/certs/DPtls/PK_S_SM_DP8_TLS.pem A smdpp-data/certs/DPtls/PK_S_SM_DP_TLS_BRP.pem A smdpp-data/certs/DPtls/PK_S_SM_DP_TLS_NIST.pem A smdpp-data/certs/DPtls/SK_S_SM_DP2_TLS_NIST.pem A smdpp-data/certs/DPtls/SK_S_SM_DP4_TLS.pem A smdpp-data/certs/DPtls/SK_S_SM_DP8_TLS.pem A smdpp-data/certs/DPtls/SK_S_SM_DP_TLS_BRP.pem A smdpp-data/certs/DPtls/SK_S_SM_DP_TLS_NIST.pem A smdpp-data/certs/README A smdpp-data/upp/TS48 V2 eSIM_GTP_SAIP2.1_NoBERTLV.rename2der A smdpp-data/upp/TS48 V2 eSIM_GTP_SAIP2.3_NoBERTLV.rename2der A tests/test_esim.py M tests/test_esim_bsp.py 84 files changed, 3,189 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/61/35461/10 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35461?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I6232847432dc6920cd2bd08c84d7099c29ca1c11 Gerrit-Change-Number: 35461 Gerrit-PatchSet: 10 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in pysim[master]: euicc: Fix delete_profile command
by laforge 07 Jan '24

07 Jan '24
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/35497?usp=email ) Change subject: euicc: Fix delete_profile command ...................................................................... euicc: Fix delete_profile command Contrary to {enable,disable}_profile, the delete_profile does not use the ProfileIdentifier TLV, but directly the Iccid / IsdpAid. Change-Id: I43e298524048703264e16cbdd0b76d82ba976985 --- M pySim/euicc.py 1 file changed, 15 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/97/35497/1 diff --git a/pySim/euicc.py b/pySim/euicc.py index 19b1c57..e45476f 100644 --- a/pySim/euicc.py +++ b/pySim/euicc.py @@ -231,7 +231,7 @@ class DeleteResult(BER_TLV_IE, tag=0x80): _construct = Enum(Int8ub, ok=0, iccidOrAidNotFound=1, profileNotInDisabledState=2, disallowedByPolicy=3, undefinedError=127) -class DeleteProfileReq(BER_TLV_IE, tag=0xbf33, nested=[ProfileIdentifier]): +class DeleteProfileReq(BER_TLV_IE, tag=0xbf33, nested=[IsdpAid, Iccid]): pass class DeleteProfileResp(BER_TLV_IE, tag=0xbf33, nested=[DeleteResult]): pass @@ -444,9 +444,9 @@ def do_delete_profile(self, opts): """Perform an ES10c DeleteProfile function.""" if opts.isdp_aid: - p_id = ProfileIdentifier(children=[IsdpAid(decoded=opts.isdp_aid)]) + p_id = IsdpAid(decoded=opts.isdp_aid) if opts.iccid: - p_id = ProfileIdentifier(children=[Iccid(decoded=opts.iccid)]) + p_id = Iccid(decoded=opts.iccid) dp_cmd_contents = [p_id] dp_cmd = DeleteProfileReq(children=dp_cmd_contents) dp = ADF_ISDR.store_data_tlv(self._cmd.lchan.scc, dp_cmd, DeleteProfileResp) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35497?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I43e298524048703264e16cbdd0b76d82ba976985 Gerrit-Change-Number: 35497 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in pysim[master]: euicc: Fix eUICC list_notifications command
by laforge 07 Jan '24

07 Jan '24
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/35498?usp=email ) Change subject: euicc: Fix eUICC list_notifications command ...................................................................... euicc: Fix eUICC list_notifications command Prior to this patch, the command would always raise exceptions. Change-Id: I75a7840c3f4b68bfc164a43908b100dd6e41e575 --- M pySim/euicc.py 1 file changed, 15 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/98/35498/1 diff --git a/pySim/euicc.py b/pySim/euicc.py index e45476f..e405f30 100644 --- a/pySim/euicc.py +++ b/pySim/euicc.py @@ -141,12 +141,13 @@ # SGP.22 Section 5.7.9: ListNotification class ProfileMgmtOperation(BER_TLV_IE, tag=0x81): - _construct = FlagsEnum(Byte, install=1, enable=2, disable=4, delete=8) + # we have to ignore the first byte which tells us how many padding bits are used in the last octet + _construct = Struct(Byte, "pmo"/FlagsEnum(Byte, install=0x80, enable=0x40, disable=0x20, delete=0x10)) class ListNotificationReq(BER_TLV_IE, tag=0xbf28, nested=[ProfileMgmtOperation]): pass class SeqNumber(BER_TLV_IE, tag=0x80): - _construct = GreedyInteger -class NotificationAddress(BER_TLV_IE, tag=0x82): + _construct = GreedyInteger() +class NotificationAddress(BER_TLV_IE, tag=0x0c): _construct = Utf8Adapter(GreedyBytes) class Iccid(BER_TLV_IE, tag=0x5a): _construct = BcdAdapter(GreedyBytes) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/35498?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I75a7840c3f4b68bfc164a43908b100dd6e41e575 Gerrit-Change-Number: 35498 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • ...
  • 156
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.