Assigning TAR information to the loaded applet

Hello,
I’m trying to assign a TAR to an applet that I want to install on the sysmoISIM-SJA5 card. I set the “install-parameters-stk” argument according to the parameters in the Tag “CA” table of the ETSI TS 102 226 [ 8.2.1.3.2.1] document.

Additionally, the “SimFileAccessAndToolkitAppSpecParams” structure in pysim/ota.py is assigned with this argument.

# TS 102 226 Section 8.2.1.3.2.1
SimFileAccessAndToolkitAppSpecParams = Struct('access_domain'/Prefixed(Int8ub, GreedyBytes),
                                              'prio_level_of_tk_app_inst'/Int8ub,
                                              'max_num_of_timers'/Int8ub,
                                              'max_text_length_for_menu_entry'/Int8ub,
                                              'menu_entries'/PrefixedArray(Int8ub, Struct('id'/Int8ub,
                                                                                          'pos'/Int8ub)),
                                              'max_num_of_channels'/Int8ub,
                                              'msl'/Prefixed(Int8ub, GreedyBytes),
                                              'tar_values'/Prefixed(Int8ub, GreedyRange(Bytes(3))))

0x01 : Length of Access Domain field(1 byte) (p=1)
0x00 : Access Domain(p byte)
0x01: Priority level of the Toolkit application instance(1 byte)
0x00: Maximum number of timers allowed for this application instance(1 byte)
0x15: Maximum text length for a menu entry(1 byte)
0x01: Maximum number of menu entries allowed for this application
instance(1 byte, m=1)
0x00: Position of the first menu entry(1 bt
0x00: Identifier of the first menu entry (2xm bytes end)
0x01: Maximum number of channels for this application instance(1byte)
0x00: Length of Minimum Security Level field (q=0)
0x03 Length of TAR Value(s) field(1byte, y=1)
3 x y: BFFFFF (TAR Value(s) of the Toolkit Application instance)

If MSL is to be adjusted;
0x01: Maximum number of channels for this application instance(1byte)
0x02: Length of Minimum Security Level field (q=2)
0x01: (Minimum SPI1) —> ETSI TS 102 226 [8.2.1.3.2.4.1] MSL Parameter
0x06: → First octet of SPI
0x03: Length of TAR Value(s) field(1byte, y=1)
3xy: BFFFFF (TAR Value(s) of the Toolkit Application instance)

So, finally datas:
0100010015010000010003BFFFFF and
01000100150100000102010603BFFFFF

pySIM-shell (SCP02[01]:00:MF/ADF.ISD)> install_cap /home/anda/HelloSTK.cap --install-parameters-non-volatile-memory-quota 255 --install-parameters-volatile-memory-quota 255 --install-parameters-stk 01000100150100000102010603BFFFFF
loading cap--------- file: /home/anda/HelloSTK.cap ...
else
Stk_parameter: 01000100150100000102010603bfffff
stkparameterrrr
parameters:
 security-domain-aid: a000000003000000
 load-file: 786 bytes
 load-file-aid: d07002ca44
 module-aid: d07002ca44900101
 application-aid: d07002ca44900101
 install-parameters: c900ef1ac80200ffc70200ffca1001000100150100000102010603bfffff
step #1: install for load...
step #2: load...
Loaded a total of 790 bytes in 4 blocks. Don't forget install_for_install (and make selectable) now!
step #3: install_for_install (and make selectable)...
done.

I installed both data by changing various TAR values ​​and when I tried to access TAR via OTA SMS by resetting the SIM card, I got the following response: SW: 9000, data: 027100000b0abfffff00000000000009. This means the “09-TAR Unknown” error in ETSI TS 102 225, Table 5.

I verify the installed application from the phone. Does the --install-parameters-stk argument match the application-aid with the TAR information? Is it possible to see the TAR information of the loaded applet with pysim?

I found the source of the error. The problem was caused by the missing reg.setEvent(EVENT_FORMATTED_SMS_PP_ENV); in the Java applet.

1 Like