pySim-shell: Detect different eUICC types and print during start-up

Change-Id: I54ea4ce663693f3951040dcc8a16bf532bf99c02
This commit is contained in:
Harald Welte
2024-09-06 15:40:19 +02:00
committed by laforge
parent 72186cce84
commit 84857accf3
4 changed files with 45 additions and 3 deletions

View File

@@ -178,7 +178,7 @@ class DF_CDMA(CardDF):
class CardProfileRUIM(CardProfile): class CardProfileRUIM(CardProfile):
'''R-UIM card profile as per 3GPP2 C.S0023-D''' '''R-UIM card profile as per 3GPP2 C.S0023-D'''
ORDER = 2 ORDER = 20
def __init__(self): def __init__(self):
super().__init__('R-UIM', desc='CDMA R-UIM Card', cla="a0", super().__init__('R-UIM', desc='CDMA R-UIM Card', cla="a0",

View File

@@ -31,8 +31,10 @@ from osmocom.utils import Hexstr
from osmocom.tlv import * from osmocom.tlv import *
from osmocom.construct import * from osmocom.construct import *
from pySim.exceptions import SwMatchError
from pySim.utils import Hexstr, SwHexstr, SwMatchstr from pySim.utils import Hexstr, SwHexstr, SwMatchstr
from pySim.commands import SimCardCommands from pySim.commands import SimCardCommands
from pySim.ts_102_221 import CardProfileUICC
import pySim.global_platform import pySim.global_platform
# SGP.02 Section 2.2.2 # SGP.02 Section 2.2.2
@@ -555,3 +557,43 @@ class CardApplicationECASD(pySim.global_platform.CardApplicationSD):
@with_default_category('Application-Specific Commands') @with_default_category('Application-Specific Commands')
class AddlShellCommands(CommandSet): class AddlShellCommands(CommandSet):
pass pass
class CardProfileEuiccSGP32(CardProfileUICC):
ORDER = 5
def __init__(self):
super().__init__(name='IoT eUICC (SGP.32)')
@classmethod
def _try_match_card(cls, scc: SimCardCommands) -> None:
# try a command only supported by SGP.32
scc.cla_byte = "00"
scc.select_adf(AID_ISD_R)
CardApplicationISDR.store_data_tlv(scc, GetCertsReq(), GetCertsResp)
class CardProfileEuiccSGP22(CardProfileUICC):
ORDER = 6
def __init__(self):
super().__init__(name='Consumer eUICC (SGP.22)')
@classmethod
def _try_match_card(cls, scc: SimCardCommands) -> None:
# try to read EID from ISD-R
scc.cla_byte = "00"
scc.select_adf(AID_ISD_R)
eid = CardApplicationISDR.get_eid(scc)
# TODO: Store EID identity?
class CardProfileEuiccSGP02(CardProfileUICC):
ORDER = 7
def __init__(self):
super().__init__(name='M2M eUICC (SGP.02)')
@classmethod
def _try_match_card(cls, scc: SimCardCommands) -> None:
scc.cla_byte = "00"
scc.select_adf(AID_ECASD)
scc.get_data(0x5a)
# TODO: Store EID identity?

View File

@@ -786,7 +786,7 @@ class EF_UMPC(TransparentEF):
class CardProfileUICC(CardProfile): class CardProfileUICC(CardProfile):
ORDER = 1 ORDER = 10
def __init__(self, name='UICC'): def __init__(self, name='UICC'):
files = [ files = [

View File

@@ -1086,7 +1086,7 @@ class DF_GSM(CardDF):
class CardProfileSIM(CardProfile): class CardProfileSIM(CardProfile):
ORDER = 3 ORDER = 30
def __init__(self): def __init__(self):
sw = { sw = {