diff --git a/README.md b/README.md index 2ed2cac..39503b4 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,9 @@ CLA = `A0` (GSM 11.11 / ISO 7816-4). | DEACTIVATE FILE | 04 | Deactivate a file | | VERIFY PIN | 20 | Verify PIN1 or PIN2 | | CHANGE PIN | 24 | Change PIN1 or PIN2 | +| UNBLOCK PIN | 2C | Unblock a PIN with the PUK | +| SEARCH RECORD (SEEK) | A2 | Search a linear fixed EF for a pattern; P2 selects type 1/2 and the mode (TS 151 011 §9.2.7) | +| INCREASE | 32 | Add a value to the last increased/updated record of a cyclic EF (3-byte value, TS 151 011 §9.2.8) | #### SELECT methods @@ -91,6 +94,18 @@ CLA = `A0` (GSM 11.11 / ISO 7816-4). CLA = `00` (ETSI TS 102 221). Same commands as SIM, but SELECT uses P1=09, P2=0C (by FID from current directory). +The UICC administrative command set is available on top of the SIM set (ETSI TS 102 221/102 222): + +| Command | INS | Description | +|---|---|---| +| SEARCH RECORD | A2 | Simple (P2=10/12, P1 = record number) and enhanced (P2=18, 2-byte indication) search per TS 102 221 §11.1.7 | +| INCREASE | 32 | Add a value to a cyclic EF record; optional SFI in P1 (TS 102 221 §11.1.8) | +| CREATE FILE | E0 | Create an EF from an FCP template; **Build template** composes a structural skeleton (TS 102 222 §6.3) | +| DELETE FILE | E4 | Delete the EF/DF with the given FID (TS 102 222 §6.4) | +| RESIZE FILE | D4 | Resize a file (FCP with FID + new size); CLA `80` per TS 102 222 Table 1 (TS 102 222 §6.10) | +| SET DATA | DB | Write a BER-TLV object; P2 selects first/next/retransmit block (+SFI) (TS 102 221 §11.3.2) | +| RETRIEVE DATA | CB | Read a BER-TLV object or the tag list (`5C`); P2 as above (TS 102 221 §11.3.1) | + #### References - ETSI TS 102 221: UICC-Terminal Interface; Physical and Logical Characteristics @@ -110,11 +125,17 @@ Two encoding variants: | Type | Tag | Description | |---|---|---| -| C-APDU | 22 | Raw APDU hex | +| C-APDU | 22 | Any remote management command: raw hex or built with the SIM RFM / USIM RFM / RAM-GP editors (TS 102 226 §5.2.1.0) | | Immediate Action | 81 | Proactive command or action indicator | | Error Action | 82 | Proactive command on error | | Script Chaining | 83 | Chaining data for multi-packet scripts | +#### C-APDU rows + +A C-APDU row starts in **Hex** mode (paste any command) and can switch to a one-row **SIM RFM**, **USIM RFM** or **RAM/GP** editor that builds the command from fields — the resulting APDU is wrapped in the `22` TLV and echoed next to the picker. GET RESPONSE is not offered there: the expanded format carries no GET RESPONSE (TS 102 226 §5.2.1.1). **→ Expanded Script** in the SIM RFM / USIM RFM / RAM-GP views appends their built commands as C-APDU rows (GET RESPONSE hops dropped). + +Only REFRESH, DISPLAY TEXT and PLAY TONE are allowed as an Immediate Action (TS 102 226 Table 5.5) and only DISPLAY TEXT and PLAY TONE as an Error Action (Table 5.9); the behaviour of the card for any other proactive command is undefined. + #### Immediate Action builder When the type is set to Immediate Action, the tool provides a structured builder for: @@ -150,9 +171,13 @@ CLA = `80` (GlobalPlatform Card Specification v2.3.1). Remote Application Manage | GET DATA | CA | tag | Read card data objects | | STORE DATA | E2 | 00/40/80/C0 | Store data (key, certificate, etc.) | | SET STATUS | F0 | 80/40/60 | Lifecycle state management | +| PUT KEY | D0 | key ver | Replace a key: P1 = key version, P2 = key identifier, data = new key material (GP Card Spec §11.8) | +| PUSH | EC | 01 | Ask an application to open a BIP channel / CAT_TP link / TCP connection or send an identification packet (TS 102 226 §9) | | EXTERNAL AUTHENTICATE | 82 | 00 | SCP host authentication | | INTERNAL AUTHENTICATE | 88 | 00 | Card challenge-response | +**PUSH** (TS 102 226 §9.2) is a C-APDU (`80 EC 01 P2`) addressed to an application that supports BIP and/or CAT_TP — not the HTTP administration trigger (that is the HTTP OTA builder above). P2: `01` BIP channel opening (OPEN CHANNEL COMPREHENSION-TLVs, optional), `02` CAT_TP link (destination port in transport level `3C` with protocol type 00, optional buffer size `39` / channel data `36`), `03` TCP connection (bearer `35`, transport level `3C` with protocol type 02 = TCP client remote, destination address `3E`, NAA/APN `47`), `04` identification packet (channel data `36`; the ICCID is used when absent). The application issues the proactive OPEN CHANNEL itself; success is `90 00`, failure `6F 00` with the Result TLV in the response data, malformed data is rejected with `6A 80`. + #### INSTALL [for install] — Privilege Builder Tag `C7` in the INSTALL data field. Built from 3 privilege bytes (GP spec Tables 11-7, 11-8, 11-9): diff --git a/README_RUS.md b/README_RUS.md index 38ce7e9..3ab77d3 100644 --- a/README_RUS.md +++ b/README_RUS.md @@ -64,6 +64,9 @@ CLA = `A0` (GSM 11.11 / ISO 7816-4). | DEACTIVATE FILE | 04 | Деактивация файла | | VERIFY PIN | 20 | Проверка PIN1 или PIN2 | | CHANGE PIN | 24 | Смена PIN1 или PIN2 | +| UNBLOCK PIN | 2C | Разблокировка PIN через PUK | +| SEARCH RECORD (SEEK) | A2 | Поиск образца в линейном фиксированном EF; P2 задаёт тип 1/2 и режим (TS 151 011 §9.2.7) | +| INCREASE | 32 | Прибавить значение к последней увеличенной/обновлённой записи циклического EF (3 байта, TS 151 011 §9.2.8) | #### Методы SELECT @@ -91,6 +94,18 @@ CLA = `A0` (GSM 11.11 / ISO 7816-4). CLA = `00` (ETSI TS 102 221). Те же команды, что и SIM, но SELECT использует P1=09, P2=0C. +Дополнительно доступны административные команды UICC (ETSI TS 102 221/102 222): + +| Команда | INS | Описание | +|---|---|---| +| SEARCH RECORD | A2 | Простой (P2=10/12, P1 = номер записи) и расширенный (P2=18, 2-байтовое indication) поиск по TS 102 221 §11.1.7 | +| INCREASE | 32 | Прибавить значение к записи циклического EF; необязательный SFI в P1 (TS 102 221 §11.1.8) | +| CREATE FILE | E0 | Создание EF из шаблона FCP; кнопка **Build template** собирает структурный каркас (TS 102 222 §6.3) | +| DELETE FILE | E4 | Удаление EF/DF по FID (TS 102 222 §6.4) | +| RESIZE FILE | D4 | Изменение размера файла (FCP с FID + новый размер); CLA `80` по TS 102 222 Table 1 (TS 102 222 §6.10) | +| SET DATA | DB | Запись BER-TLV объекта; P2 выбирает первый/следующий/повторный блок (+SFI) (TS 102 221 §11.3.2) | +| RETRIEVE DATA | CB | Чтение BER-TLV объекта или списка тегов (`5C`); P2 как выше (TS 102 221 §11.3.1) | + #### Ссылки - ETSI TS 102 221: UICC-Terminal Interface @@ -109,11 +124,17 @@ CLA = `00` (ETSI TS 102 221). Те же команды, что и SIM, но SELE | Тип | Тег | Описание | |---|---|---| -| C-APDU | 22 | APDU | +| C-APDU | 22 | Любая команда удалённого управления: hex или собранная редакторами SIM RFM / USIM RFM / RAM-GP (TS 102 226 §5.2.1.0) | | Immediate Action | 81 | Proactive-команда или action indicator | | Error Action | 82 | Proactive-команда при ошибке | | Script Chaining | 83 | Данные для многопакетных скриптов | +#### Строки C-APDU + +Строка C-APDU начинает в режиме **Hex** (вставьте любую команду) и может переключиться на одно-строчный редактор **SIM RFM**, **USIM RFM** или **RAM/GP**, который собирает команду из полей — итоговый APDU оборачивается в TLV `22` и показывается рядом с выбором. GET RESPONSE там не предлагается: расширенный формат не несёт GET RESPONSE (TS 102 226 §5.2.1.1). Кнопка **→ Расширенный скрипт** в представлениях SIM RFM / USIM RFM / RAM-GP добавляет их команды строками C-APDU (строки GET RESPONSE отбрасываются). + +Только REFRESH, DISPLAY TEXT и PLAY TONE допустимы как Immediate Action (TS 102 226 Table 5.5), и только DISPLAY TEXT и PLAY TONE — как Error Action (Table 5.9); поведение карты для других проактивных команд не определено. + #### Сборщик Immediate Action - **Action indicator**: `81` / `82` @@ -145,9 +166,13 @@ CLA = `80` (GlobalPlatform v2.3.1). Удалённое управление со | GET DATA | CA | tag | Чтение объектов данных | | STORE DATA | E2 | 00/40/80/C0 | Запись данных | | SET STATUS | F0 | 80/40/60 | Управление жизненным циклом | +| PUT KEY | D0 | key ver | Замена ключа: P1 = версия ключа, P2 = идентификатор, данные = новый ключевой материал (GP Card Spec §11.8) | +| PUSH | EC | 01 | Просьба приложению открыть BIP-канал / CAT_TP / TCP или отправить пакет идентификации (TS 102 226 §9) | | EXTERNAL AUTHENTICATE | 82 | 00 | Аутентификация SCP | | INTERNAL AUTHENTICATE | 88 | 00 | Challenge-response | +**PUSH** (TS 102 226 §9.2) — это C-APDU (`80 EC 01 P2`), адресованный приложению, поддерживающему BIP и/или CAT_TP (не триггер HTTP-администрирования — тот собирается в конструкторе HTTP OTA выше). P2: `01` открытие BIP-канала (COMPREHENSION-TLV OPEN CHANNEL, необязательно), `02` CAT_TP (порт назначения в transport level `3C` с типом протокола 00, необязательные buffer size `39` / channel data `36`), `03` TCP (bearer `35`, transport level `3C` с типом протокола 02 = TCP-клиент, удалённое соединение, адрес назначения `3E`, NAA/APN `47`), `04` пакет идентификации (channel data `36`; при отсутствии используется ICCID). Проактивную OPEN CHANNEL выдаёт само приложение; успех — `90 00`, отказ — `6F 00` с Result TLV в данных ответа, некорректные данные отклоняются с `6A 80`. + #### Привилегии (INSTALL [for install]) Три байта привилегий по GP Spec Tables 11-7, 11-8, 11-9. diff --git a/frontend/help-ru.html b/frontend/help-ru.html index 106ca7c..fb3215f 100644 --- a/frontend/help-ru.html +++ b/frontend/help-ru.html @@ -74,6 +74,8 @@
61XX/9FXXДля record-команд режим P2: Absolute (04), Next (02) или Previous (03). Если за Case 4 командой сразу следует строка GET RESPONSE, сборщик цепочки автоматически убирает её байт Le (ETSI TS 102 226 §5.1.1). В правой колонке — панель конвертации (IMSI, MSISDN, ICCID, SPN, PLMN, nibble swap). См. §2.5.
+→ Расширенный скрипт отправляет собранную цепочку в конструктор Expanded Script строками C-APDU (строки GET RESPONSE отбрасываются — расширенный формат их не использует, TS 102 226 §5.2.1.1). Приложение UICC Shared File System RFM (TAR B00000) доступно и в компактном, и в расширенном формате — если TAR не настроен на автоопределение формата, используются разные значения TAR (TS 102 226 §7.0/§5.3).
CLA = 00 (ETSI TS 102 221). Тот же сборщик цепочки и набор команд, что и SIM. Отличия:
CLA = 00 (ETSI TS 102 221). Тот же сборщик цепочки и набор команд, что и SIM, плюс административные команды UICC и формы SEARCH RECORD / INCREASE из TS 102 221:
04) и добавляет Le=00; флажок Silent (P2=0C) выбирает файл без запроса FCP (без Le, без данных ответа).08) или from current DF (P1=09); текущий DF сессии ADF RFM — ADF.USIM.B00001), привязанный к AID ADF (ADF.USIM).10/12, P1 = номер записи) и расширенный режим (P2=18) с 2-байтовым search indication; INCREASE (§11.1.8) принимает необязательный SFI и прибавляемое значение.8C 02 7F 00 — проверьте его для своей карты). RESIZE FILE использует CLA 80 (TS 102 222 Table 1: '8X'/'CX').5C — список размещённых тегов).Сборщик Immediate Action предлагает action indicator (81/82), структурированный сборщик проактивных команд (REFRESH, DISPLAY TEXT, PLAY TONE с авто-генерацией COMPREHENSION-TLV), или ручной hex-ввод.
Строка C-APDU начинает в режиме Hex (вставьте любую команду) и может переключиться на одно-строчный редактор SIM RFM, USIM RFM или RAM/GP, который собирает команду из полей — итоговый APDU оборачивается в TLV 22 и показывается рядом с выбором. GET RESPONSE там не предлагается: расширенный формат не несёт GET RESPONSE (TS 102 226 §5.2.1.1). Кнопка → Расширенный скрипт в представлениях SIM RFM / USIM RFM / RAM-GP добавляет их команды строками C-APDU.
Только три проактивные команды допустимы как Immediate Action (TS 102 226 Table 5.5): REFRESH, DISPLAY TEXT и PLAY TONE — поведение карты для любой другой проактивной команды не определено.
Восстановление при ошибках по TS 102 226 §5.2.1.3 — одна из четырёх форм:
@@ -131,13 +139,14 @@Многопакетное выполнение скрипта с сохранением контекста:
+Многопакетное выполнение скрипта с сохранением контекста (TS 102 226 §5.2.1.4). TLV имеет вид 83 01 <флаг>, присутствует один раз и только как первый Command TLV; допускается для RFM и RAM:
01 первый скрипт (удалять инфо о цепочке при сбросе), 11 первый скрипт (сохранять инфо о цепочке при сбросе, только RFM), 02 последующий скрипт (будут ещё), 03 последующий скрипт (последний)01 — первый скрипт, удалить информацию цепочки при сбросе карты11 — первый скрипт, сохранить информацию цепочки при сбросе карты (только RFM)02 — последующий скрипт, далее будут ещё03 — последующий скрипт, последнийПри цепочке сессия команд выходит за рамки одного шаблона: UICC сохраняет контекст файла/PIN (RFM) или сессию приложения (RAM, например цепочку STORE DATA) до последнего скрипта.
Входящие ответы Proof of Receipt декодируются сервером — формат expanded Remote Application response data (TS 102 226 §5.2.2) или компактный формат. Представление Secured Packet показывает результат после Отправить на карту (см. §3.1): статус PoR (TAR, счётчик, сырой PoR), а статусное слово и данные ответа последней команды подставляются в подвкладку «Парсер ответов» (Remote APDU).
@@ -160,6 +169,8 @@61XX (Le настраивается)Полные таблицы GET STATUS P1/P2, тегов GET DATA, DELETE P1, STORE DATA P1 и SET STATUS см. в GlobalPlatform v2.3.1 и ETSI TS 102 226 §8.2.1.3.2.
+PUSH (TS 102 226 §9.2) — это C-APDU (80 EC 01 P2), адресованный приложению, поддерживающему BIP и/или CAT_TP (не триггер HTTP-администрирования — тот собирается в конструкторе HTTP OTA выше). P2: 01 открытие BIP-канала (COMPREHENSION-TLV OPEN CHANNEL, необязательно), 02 CAT_TP-соединение (порт назначения в transport level 3C с типом протокола 00, необязательные buffer size 39 / channel data 36), 03 TCP-соединение (bearer 35, transport level 3C с типом протокола 02 = TCP-клиент, удалённое соединение, адрес назначения 3E, NAA/APN 47), 04 пакет идентификации (channel data 36; при отсутствии используется ICCID). Проактивную команду OPEN CHANNEL выдаёт само приложение; успех — 90 00, отказ — 6F 00 с Result TLV в данных ответа, некорректные данные отклоняются с 6A 80. P1 80 зарезервирован для приложения.
61XX/9FXX status wordFor record commands, the P2 mode is Absolute (04), Next (02), or Previous (03). When a Case 4 command is immediately followed by a GET RESPONSE row, the chain builder strips its trailing Le byte automatically (ETSI TS 102 226 §5.1.1). A conversion panel is embedded in the right column (IMSI, MSISDN, ICCID, SPN, PLMN, nibble swap). See §2.5.
+→ Expanded Script sends the built chain to the Expanded Script builder as C-APDU rows (GET RESPONSE hops are dropped — the expanded format does not use them, TS 102 226 §5.2.1.1). The UICC Shared File System RFM application (TAR B00000) is reachable with either the compact or the expanded format — unless the TAR is configured for automatic format detection, the two use different TAR values (TS 102 226 §7.0/§5.3).
CLA = 00 (ETSI TS 102 221). Same chain builder and command set as SIM. Differences:
CLA = 00 (ETSI TS 102 221). Same chain builder and command set as SIM, plus the UICC administrative commands, and the TS 102 221 forms of SEARCH RECORD / INCREASE:
04) and appends Le=00; a Silent (P2=0C) checkbox selects without requesting FCP (no Le, no response data).08) or from current DF (P1=09); the current DF of an ADF RFM session is ADF.USIM.10/12, P1 = record number) and the enhanced mode (P2=18) with the 2-byte search indication; INCREASE (§11.1.8) takes an optional SFI and the value to add.8C 02 7F 00 — review it for your card). RESIZE FILE uses CLA 80 (TS 102 222 Table 1: '8X'/'CX').5C lists the allocated tags).B00001 by default), linked to the ADF’s AID (ADF.USIM).The Immediate Action builder offers an action indicator (81/82), a structured proactive command builder (REFRESH, DISPLAY TEXT, PLAY TONE with auto-generated COMPREHENSION-TLV objects), or a freeform hex input.
A C-APDU row starts in Hex mode (paste any command) and can switch to a one-row SIM RFM, USIM RFM or RAM/GP editor that builds the command from fields — the resulting APDU is wrapped in the 22 TLV and shown next to the picker. GET RESPONSE is not offered there: the expanded format carries no GET RESPONSE (TS 102 226 §5.2.1.1). → Expanded Script in the SIM RFM / USIM RFM / RAM-GP views appends their built commands as C-APDU rows.
The Immediate Action builder offers an action indicator (81/82), a structured proactive command builder (REFRESH, DISPLAY TEXT, PLAY TONE with auto-generated COMPREHENSION-TLV objects), or a freeform hex input. Only those three proactive commands are allowed as an Immediate Action (TS 102 226 Table 5.5) — the behaviour of the card for any other proactive command is undefined.
Error recovery per TS 102 226 §5.2.1.3 — one of four forms:
@@ -131,13 +138,14 @@Multi-packet script execution with context preservation:
+Multi-packet script execution with context preservation (TS 102 226 §5.2.1.4). The TLV is 83 01 <flag>, present once and only as the first Command TLV; it may be used for RFM and RAM only:
01 first script (delete chaining info on reset), 11 first script (keep chaining info across reset, RFM only), 02 subsequent script (more to follow), 03 subsequent script (last)01 — first script, delete chaining information upon card reset11 — first script, keep chaining information across card reset (RFM only)02 — subsequent script, more to follow03 — subsequent script, last oneWith chaining the command session is extended beyond one scripting template: the UICC keeps the file/PIN context (RFM) or the application session (RAM, e.g. a chained STORE DATA sequence) until the last script.
Incoming Proof-of-Receipt responses are decoded by the server — expanded Remote Application response data (TS 102 226 §5.2.2) or the compact format. The Secured Packet view shows the outcome after Send to Card (see §3.1): the PoR status (TAR, counter, raw PoR), with the last command’s status word and response data filled into the Response parser pill under Remote APDU.
@@ -160,6 +168,8 @@61XX status (Le configurable)Refer to GlobalPlatform v2.3.1 and ETSI TS 102 226 §8.2.1.3.2 for the full GET STATUS P1/P2, GET DATA tag, DELETE P1, STORE DATA P1, and SET STATUS tables.
+PUSH (TS 102 226 §9.2) is a C-APDU (80 EC 01 P2) addressed to an application that supports BIP and/or CAT_TP — not the HTTP administration trigger (that is the HTTP OTA builder above). P2: 01 BIP channel opening (OPEN CHANNEL COMPREHENSION-TLVs, optional), 02 CAT_TP link (destination port in transport level 3C with protocol type 00, optional buffer size 39 / channel data 36), 03 TCP connection (bearer 35, transport level 3C with protocol type 02 = TCP client remote, destination address 3E, NAA/APN 47), 04 identification packet (channel data 36; the ICCID is used when absent). The application issues the proactive OPEN CHANNEL itself; success is 90 00, failure 6F 00 with the Result TLV in the response data, and malformed data is rejected with 6A 80. P1 80 is reserved for application-specific usage.