fix: always emit the mandatory C9 in the install parameters (v3.6.20)

The v3.6.17 prefix built `C9` only when its field was filled, so filling the
C7/C8 quotas with an empty C9 produced `EF…`-only Install Parameters - and
GP Table 11-49 makes C9 mandatory, so the card rejected the data field with
6A80 (decrypted live packet: params started `EF08C7020000C8020000EA25…`).

- `ramParamsPrefix` always emits the C9 TLV (empty -> `C900`, like the
  reference tools); the vendor form becomes `C900 EF08 C7020000 C8020000
  EA…`.
- the raw "Install parameters (hex)" field is relabelled "Extra install
  parameters (hex)" - it appends extra TLVs after the generated prefix.
- tests updated (empty prefix -> `C900`, quotas-only ->
  `C900EF08C7020000C8020000`).

650 frontend / 499 Python green; version 3.6.20; sw simple-v293.
This commit is contained in:
2026-09-28 08:29:29 +03:00
parent 31162efc8c
commit 2d268f024b
5 changed files with 18 additions and 13 deletions
+5 -3
View File
@@ -131,11 +131,13 @@ test('adfAidFromFci extracts the DF name (tag 84) from an FCI', () => {
test('ramParamsPrefix composes C9 + EF (C7/C8) like the vendor scripts', () => {
// The vendor's working install (samples/uicc/applets/STK3):
// C9 22 <config> EF 08 C7 02 0000 C8 02 0000 EA ...
assert.strictEqual(ramParamsPrefix('', '', ''), '');
// C9 is mandatory (GP Table 11-49): an empty field is sent as C9 00 -
// without it the card rejects the data field with 6A80 (live 2026-09-28).
assert.strictEqual(ramParamsPrefix('', '', ''), 'C900');
assert.strictEqual(ramParamsPrefix('082905112000012066', '', ''),
'C909082905112000012066');
assert.strictEqual(ramParamsPrefix('', '0', '0'), 'EF08C7020000C8020000');
assert.strictEqual(ramParamsPrefix('', '32768', ''), 'EF06C70400008000');
assert.strictEqual(ramParamsPrefix('', '0', '0'), 'C900EF08C7020000C8020000');
assert.strictEqual(ramParamsPrefix('', '32768', ''), 'C900EF06C70400008000');
assert.strictEqual(ramParamsPrefix('AA', '', '1234'), 'C901AAEF04C80204D2');
});