Hello,

Sorry, for the late reply. (replying again as prev mails failed)

>> Which is "your test sim".  Can you share the make and model?
It's a sysmoUSIM-SJS1, I believe.

I'm receiving 9000 for INSTALL for load, and for consequent LOAD
commands 9000 as well. Only for the last INSTALL for install, I'm
getting 6A88 (reference data not found). I think, the issue is in
AIDs. I'm trying to figure out if I should use arbitrary bytes for AID
or construct AID (which includes RID + RIX) the same way as
existing Load Files, Applets' AID are on the SIM card?

I'm using d07002CA44 from this https://github.com/mrlnc/HelloSTK2,
I believe that should be reason for the 6A88 error code.

Could you please assist?

Here is my Install for Install Python3 code:
--
def install_install_make_selectable(self, exe_rid="d07002CA44",
        module_aid="d07002CA44900101",
        app_aid="d07002CA44900101"):
        apdu = "".join([
            "80",   # CLS
            "e6",   # INSTR
            "0c",   # p1 ; for install (b3=1) ; for make selectable (b4=1)
            "00",   # p2
            "%02x", # p3 ; Lc
        ])
        # 11.5.2.3.2, page 170
        data = "".join([
            "%02x" % int(len(exe_rid)/2),
            exe_rid,    # V, executable Load file AID / load file AID
            "%02x" % int(len(module_aid)/2),
            module_aid, # V, executable Module AID / class file AID
            "%02x" % int(len(app_aid)/2),
            app_aid,    # V, Application AID / instance AID

            "0100",     # L privileges ; V=00, 11.1.2 Privileges
Coding, page 146
            "%02x",     # L Install Parameters field
        ])
        system_params_v = "".join([
            "c802",     # TL - non-volatile memory quota
            "00ff",     # V
            "c702",     # TL - volatile memory quota
            "00ff",
        ])
        install_params_tl = "".join([
            "EF",       # T - System Specific Parameters
            "%02x"
        ])

        install_params_v =  ""
        install_params_v += system_params_v

        install_params_v += "".join([
            # ETSI 102 226, page 23
            # 8.2.1.3.2.1   Coding of the SIM File Access and Toolkit
Application Specific Parameters
            "ca",
            "%02x",     # TL
        ])
        toolkit_app_params = "".join([
            "01",       # L of access domain

            ##
            ## Access Domain
            ## 00 - full access
            ## 01 - APDU access (reserved for 2G; see 3GPP TS 31 116)
            ## 02 - UICC access (reserved for 3G)
            ## ff - no access
            ##
            "ff",       # V access domain

            "01",       # V priority
            "00",       # V max timers
            "0f",       # V max menu text
            "02",       # V max menu entries
            "0000" * int("02"),
            "00",   # max number of channels for this application instance
            "00",   # length of MSL
        ])
        install_params_v = install_params_v %
int(len(toolkit_app_params)/2) + toolkit_app_params

        ### C9 - Application Specific Parameters (none?)
        applet_specific_params_v = "".join([
            ""
        ])
        applet_specific_params_tlv = "".join([
            "c9",
            "%02x" % int(len(applet_specific_params_v)/2),
            applet_specific_params_v
        ])
        install_params_v += applet_specific_params_tlv

        install_params = install_params_tl %
int(len(install_params_v)/2) + install_params_v
        data = data % int(len(install_params)/2) + install_params
        data += "00" # load token
        apdu = apdu % int(len(data)/2) + data
        apdu += "00c0000000"    # C-MAC
        return apdu

On Tue, Jan 4, 2022, 6:30 PM Harald Welte <laforge@osmocom.org> wrote:
Hi Sabr,


On Mon, Jan 03, 2022 at 03:51:54PM +0600, Sabyrzhan Tasbolatov wrote:
> Following up

I didn't see your original mail,  sorry.

> > I need help with installing the HelloWorld.cap applet in my test SIM.

Which is "your test sim".  Can you share the make and model?

> > I know how to construct APDUs and osmocom's shadysim.py
> > <https://git.osmocom.org/sim/sim-tools/tree/shadysim/shadysim.py>,
> > does not work properly for me.

please note that different cards have different expectations (and bugs) on the exact
parameters to load applets.   Also, shadysim is a "early proof of concept"
and not something that intended to be a full implementation and/or
support a wide variety of cards with related workarounds, etc.

--
- Harald Welte <laforge@osmocom.org>            http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)