laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved
pySim-shell: Detect different eUICC types and print during start-up

Change-Id: I54ea4ce663693f3951040dcc8a16bf532bf99c02
---
M pySim/cdma_ruim.py
M pySim/euicc.py
M pySim/ts_102_221.py
M pySim/ts_51_011.py
4 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/pySim/cdma_ruim.py b/pySim/cdma_ruim.py
index f5382c9..f20e77c 100644
--- a/pySim/cdma_ruim.py
+++ b/pySim/cdma_ruim.py
@@ -178,7 +178,7 @@
class CardProfileRUIM(CardProfile):
'''R-UIM card profile as per 3GPP2 C.S0023-D'''

- ORDER = 2
+ ORDER = 20

def __init__(self):
super().__init__('R-UIM', desc='CDMA R-UIM Card', cla="a0",
diff --git a/pySim/euicc.py b/pySim/euicc.py
index c7b59d9..6374818 100644
--- a/pySim/euicc.py
+++ b/pySim/euicc.py
@@ -31,8 +31,10 @@
from osmocom.tlv import *
from osmocom.construct import *

+from pySim.exceptions import SwMatchError
from pySim.utils import Hexstr, SwHexstr, SwMatchstr
from pySim.commands import SimCardCommands
+from pySim.ts_102_221 import CardProfileUICC
import pySim.global_platform

# SGP.02 Section 2.2.2
@@ -555,3 +557,43 @@
@with_default_category('Application-Specific Commands')
class AddlShellCommands(CommandSet):
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?
diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py
index 9fed6af..f09b1e3 100644
--- a/pySim/ts_102_221.py
+++ b/pySim/ts_102_221.py
@@ -786,7 +786,7 @@

class CardProfileUICC(CardProfile):

- ORDER = 1
+ ORDER = 10

def __init__(self, name='UICC'):
files = [
diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py
index 8cbca58..26dce8b 100644
--- a/pySim/ts_51_011.py
+++ b/pySim/ts_51_011.py
@@ -1086,7 +1086,7 @@

class CardProfileSIM(CardProfile):

- ORDER = 3
+ ORDER = 30

def __init__(self):
sw = {

To view, visit change 38049. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I54ea4ce663693f3951040dcc8a16bf532bf99c02
Gerrit-Change-Number: 38049
Gerrit-PatchSet: 10
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>