Help establish_scp02 with sysmocom test card sysmoEUICC1-C2G

Hello,
thanks very much for the forum and support.
I have just bought simcard sysmoEUICC1-C2G and I am trying to establish an scp_02, but getting the below error.
I know I must be in the ISD, but I do not know how to change the prompt of pysim-shell to get into the ISD.

On any event, i tried in isd-r (i know here is not possible, but i just tried), and get the below error.
any idea support please … thanks

pySIM-shell (00:MF/ADF.ISD-R)> establish_scp02 --key-dek 99aabbccddeeff101122334455667788 --key-enc 66778899aabbccdd1122334455eeff10 --key-mac 112233445566778899aabbccddeeff10 --security-level 1
EXCEPTION of type 'ConstError' occurred with message: Error in path (parsing)
parsing expected b'\x02' but parsed b'\x03'

Please always include the APDU trace and full python backtracbacktrace.

In any case, the ISD-R is the domain of the eUICC manufacturer (EUM), which in this case is sysmocom.

  1. You as the user cannot establish SCP to it, as you do not have access to the related key materials
  2. Only SCP03 and not SCP02 is permitted.

If you are the [real or simulated] operator and your eSIM profile is currently active, then - depending on how you’ve provisioned the eSIM profile - you could establish SCP02/03/80/81 to the ISD-P of that profile, using the key materiaal of the eSIM profile.

It might help if you could explain what exactly your goal is.

Hello, thanks very much for the support.

Want I wanted is using the card: sysmoEUICC1-C2G
perform some testing SCP02.

I already executed with success SCP80 using the below keys.
And I thought that this default profile (Operational Profile Name 1) in the simcard were able to do SCP02.

On any event, i tried selecting the ISD-P with command:
pySIM-shell (00:MF/ADF.ISD-R)> apdu 00a4040010a0000005591010ffffffff890000100000
SW: 9000, RESP: 6f188410a0000005591010ffffffff8900001000a5049f6501ff

then i try the establish scp02 below, and get this error:

pySIM-shell (00:MF)> apdu 00a4040010a0000005591010ffffffff890000100000
SW: 9000, RESP: 6f188410a0000005591010ffffffff8900001000a5049f6501ff
pySIM-shell (00:MF)> establish_scp02 --key-dek 99aabbccddeeff101122334455667788 --key-enc 66778899aabbccdd1122334455eeff10 --key-mac 112233445566778899aabbccddeeff10 --security-level 1
establish_scp02 is not a recognized command, alias, or macro.
pySIM-shell (00:MF)>

Because I cannot make pySim-shell understand that i am in ISD-mode.

Then, just for testing, i know that i cannot in isd-r, i tried been in isd-r, so that when i issue the help command the establish_scp02 command appears. i tried and get error below.

Thanks so much for any idea/light.
My aim is just testing/playing.
Maybe I need to download another profile that has a full global platform implementation…?



pySIM-shell (00:MF/ADF.ISD-R)> establish_scp02 --key-dek 99aabbccddeeff101122334455667788 --key-enc 66778899aabbccdd1122334455eeff10 --key-mac 112233445566778899aabbccddeeff10 --security-level 1
Traceback (most recent call last):
  File "/root/manuel/lib/python3.12/site-packages/cmd2/cmd2.py", line 2577, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/manuel/lib/python3.12/site-packages/cmd2/cmd2.py", line 3066, in onecmd
    stop = func(statement)
           ^^^^^^^^^^^^^^^
  File "/root/manuel/lib/python3.12/site-packages/cmd2/decorators.py", line 402, in cmd_wrapper
    return func(*args_list, **kwargs)  # type: ignore[call-arg]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/pysim/pySim/global_platform/__init__.py", line 948, in do_establish_scp02
    self._establish_scp(scp02, host_challenge, opts.security_level)
  File "/root/pysim/pySim/global_platform/__init__.py", line 981, in _establish_scp
    init_update_resp, _sw = self._cmd.lchan.scc.send_apdu_checksw(b2h(init_update_apdu))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/pysim/pySim/commands.py", line 126, in send_apdu_checksw
    return self._tp.send_apdu_checksw(pdu, sw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/pysim/pySim/transport/__init__.py", line 244, in send_apdu_checksw
    raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter)
pySim.exceptions.SwMatchError: SW match failed! Expected 9000 and got 6a88: Wrong parameters - Referenced data not found
EXCEPTION of type 'SwMatchError' occurred with message: SW match failed! Expected 9000 and got 6a88: Wrong parameters - Referenced data not found
pySIM-shell (00:MF/ADF.ISD-R)> 




pySIM-shell (00:MF/ADF.ISD-R)> get_profiles_info
{
    "profile_info_seq": [
        {
            "profile_info": {
                "iccid": "89000123456789012341",
                "isdp_aid": "a0000005591010ffffffff8900001000",
                "profile_state": "enabled",
                "service_provider_name": "SP Name 1",
                "profile_name": "Operational Profile Name 1",
                "icon_type": "png",
                "icon": "89504e470d0a1a0a0000000d49484452000000400000004008040000000060b9550000000774494d4507e00b091007364c956f97000000097048597300000b1200000b1201d2dd7efc0000000467414d410000b18f0bfc61050000021f4944415478daed99cd1583200c803d32000b3004abb00ecbb0822338578af559223f49b0a8175f2ec023e1238410db09a667e5e1e55f80bf00f686060b1e66b80420c02a32550d0e966e8cc6f0128d193460635fa66a3b7d511db48dd94788b655d7815071ba26e61b9000acc711841085eb398d84c0cd94f921ebe2ddab18db6b5005b055c3bc752b4038745c5339449cd4950248100e1d4528fac207b228e3101a4bd4ae52ba96a603808b05d44c27adab2af8807a00a6184b228014807566eca13538e5008ac890bf06be809e4dbebe0b808a842a009ffd7b010436af06b04f034c8d47ea46004703e034e4d95b90a98a447300dc353c9f07a843404d9b2d904bca84f62480a7013c39351431225b722de9f6ad591a0047c194e5ae19bd865afc1a26976f088603c0a7ac9117fce131f64200bcdfed8e290ee058906c46f2fad09dac885ab1550c68d2a8b426dcf69b8e71f76d195b15cd368207463513fd2dea6648476b2500eb999b6250fa5dc0499e0b88b921f2bbaf782e877588930370724e4d3f0dd01d49dbe7e92cb940423172008f3ed3c6011c03b1396bce6ec24800c703b862682480a20142250b8c05c081385186cd65009607d059dd772b80ae3cb963010205b054436414808abb0ff237752480a996fb3702d8334fda0bf002bc002fc0488053b5f5380005dc0a1703f03ffdfdc433a6fa010cf1ef4165c831e602b40134844c66e67fa4c1000618e5ab8f6008c03faab7028c9117e0036baf44917035af0e0000000049454e44ae426082",
                "profile_class": "test"
            }
        },
        {
            "profile_info": {
                "iccid": "8944476500001450969f",
                "isdp_aid": "a0000005591010ffffffff8900001100",
                "profile_state": "disabled",
                "service_provider_name": "Speedtest Travel",
                "profile_name": "BetterRoaming",
                "profile_class": "operational"
            }
        },
        {
            "profile_info": {
                "iccid": "8944476500001463335f",
                "isdp_aid": "a0000005591010ffffffff8900001200",
                "profile_state": "disabled",
                "service_provider_name": "BetterRoaming",
                "profile_name": "BetterRoaming",
                "profile_class": "operational"
            }
        }
    ]
}

What made you assume that? Can you please point me to which part of the sysmoEUICC user manual or the GSMA TS.48 specification states or implies that SCP02 is configured for a TS.48 test profile?

Hello again, thanks very much for the great support. You are right.
Sorry if newbie question, is there any test profile available to download containing SCP80 and GP supporting SCP02?

I’m not aware of any such readily available test profile. But anyone is free to create one, it’s not like the format is undocumented. And pySim.esim.saip has various helper library code for reading/decoding, modifying and saving esim profiles.

Note that SCP02 is very unlikely to be ever used in practice with eSIM profiles for two reasons:

  1. almost nobody ever has the capability of using a local secure messaging protocol like SCP02 or SCP03 on an eUICC as the eUICC is most often soldered and the access to it is raw APDUs is not usually exposed by operating systems
  2. SCP02 is legacy/old and still uses DES while eSIM technology is rather new. So if at all I’d expect SCP03 to be used in the eSIM context.

Would you mind sharing what is your actual goal/purpose with this?