From f17e7cb8da90467883df6587abbdca39e9bca08b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A2=D1=80=D0=BE=D1=88?=
=?UTF-8?q?=D0=B8=D0=BD?=
Date: Wed, 23 Sep 2026 08:57:59 +0300
Subject: [PATCH] =?UTF-8?q?feat:=20Push=20commands=20pill=20=E2=80=94=20GP?=
=?UTF-8?q?=20administration=20trigger=20+=20TS=20102=20226=20=C2=A79=20pu?=
=?UTF-8?q?shes=20(v3.5.0)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The former HTTP OTA pill becomes "Push commands" (RU: Пуш/триггер) and groups
everything that makes the card dial out:
- Administrative session (GP Amd B §4.7): the existing Trigger/Store UI,
unchanged, as the first section (most used).
- BIP / CAT_TP trigger (§9): request 01 BIP channel opening (optional OPEN
CHANNEL COMPREHENSION-TLVs) or 02 CAT_TP link (destination port, optional
max SDU / identification data).
- TCP trigger (§9): request 03 TCP connection (bearer, transport level with
protocol type 02, destination address 21/57/F0, NAA/APN, extra TLVs) or
04 identification packet (optional data, ICCID when absent — sent over an
already open channel).
The guided sections reuse chainPushData (the RAM/GP chain PUSH encoder) and
preview the C-APDU; mandatory parameters (02 port, 03 port + address) are
enforced there while the chain row stays lenient. Actions: Pack into Secured
packet (no auto-TAR — a §9 PUSH goes to the target application) and
→ Expanded Script (22 Command TLV import; berAppendApdu extracted from
loadExpandedScript). Each §9 request has a note separating it from the
administration session. Chain-builder PUSH command and the expanded-script
C-APDU picker are unchanged.
Tests: pushSectionApdu vectors in ts102226.test.js; help 2.7 EN/RU
restructured, READMEs, AGENTS; sw cache -> simple-v246.
---
README.md | 15 ++-
README_RUS.md | 16 ++-
frontend/help-ru.html | 13 ++-
frontend/help.html | 13 ++-
frontend/index.html | 185 ++++++++++++++++++++++++++++++--
frontend/sw.js | 2 +-
frontend/tests/ts102226.test.js | 20 +++-
pyproject.toml | 2 +-
pysim_simple_server/server.py | 2 +-
9 files changed, 250 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index 79ffada..4a271fe 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ Seven top-level tabs: **Remote APDU**, **SCP80**, **SCP81**, **Cards**, **Profil
## Remote APDU tab
-Builds command APDUs (C-APDUs). Seven sub-tabs cover different card generations, command sets and decoding tools: **SIM RFM**, **USIM RFM**, **RAM/GP**, **Expanded Script**, **HTTP OTA**, **C-APDU Parser**, and **Response parser**.
+Builds command APDUs (C-APDUs). Seven sub-tabs cover different card generations, command sets and decoding tools: **SIM RFM**, **USIM RFM**, **RAM/GP**, **Expanded Script**, **Push commands**, **C-APDU Parser**, and **Response parser**.
### SIM RFM
@@ -357,7 +357,11 @@ Swaps nibble pairs of an even-length hex string.
Pastes raw APDU hex and renders a collapsible tree. It auto-detects the container: an **Expanded Script** (leading `AA` or `AE80`, decoded per ETSI TS 102 226 §5.2.1) or a **Compact C-APDU chain** (a sequence of ISO 7816 C-APDUs). Each node shows its label, hex, and a short description; parent nodes expand to reveal their sub-elements.
-### HTTP OTA
+### Push commands
+
+Groups the commands that make the card dial out: the GlobalPlatform HTTP administration session trigger (and its Store mode) plus the ETSI TS 102 226 §9 PUSH variants. They are delivered differently - the administration trigger is a TLV message for the Security Domain, a §9 PUSH is a C-APDU (`80 EC 01 P2`) for an application that supports BIP/CAT_TP.
+
+#### Administration session (HTTP OTA)
Builds the Remote Application Management over HTTP payloads defined in GlobalPlatform **GPC v2.2 Amendment B v1.1** (§4.7). Two modes:
@@ -373,6 +377,13 @@ Builds the Remote Application Management over HTTP payloads defined in GlobalPla
The **Command Scripting template** checkbox wraps the whole `81` triggering command in the definite-length Expanded Remote Application data format (`AA`, ETSI TS 102 226 §5.2.1) for TARs that process the expanded format. **Pack into Secured packet** sends the built payload to the SCP80 tab for SPI/counter filling — insert the TAR the SD listens on (typically the OTASD TAR) there.
+#### TS 102 226 §9 PUSH
+
+Two guided sections build the §9 requests with the same encoder as the RAM/GP chain's **PUSH** row and offer **Pack into Secured packet** (TAR stays manual - the request goes to the target application) and **→ Expanded Script** (wraps the APDU in the `22` Command TLV):
+
+- **BIP / CAT_TP** — `01` BIP channel opening (OPEN CHANNEL COMPREHENSION-TLVs optional) or `02` CAT_TP link (destination port in transport level `3C` with protocol type 00, optional buffer size `39` / identification data `36`);
+- **TCP** — `03` TCP connection (bearer `35`, transport level `3C` with protocol type 02, destination address `3E` - `21` IPv4 / `57` IPv6 / `F0` FQDN, NAA/APN `47`) or `04` identification packet (sent over an already open channel; the ICCID is used when absent).
+
---
diff --git a/README_RUS.md b/README_RUS.md
index 0758036..d02eac4 100644
--- a/README_RUS.md
+++ b/README_RUS.md
@@ -44,7 +44,7 @@ npm run build
## Вкладка Remote APDU
-Построение команд APDU (C-APDU). Семь подвкладок для разных поколений карт, наборов команд и инструментов разбора: **SIM RFM**, **USIM RFM**, **RAM/GP**, **Expanded Script**, **HTTP OTA**, **Разбор C-APDU** и **«Парсер ответов»**.
+Построение команд APDU (C-APDU). Семь подвкладок для разных поколений карт, наборов команд и инструментов разбора: **SIM RFM**, **USIM RFM**, **RAM/GP**, **Expanded Script**, **Пуш/триггер**, **Разбор C-APDU** и **«Парсер ответов»**.
### SIM RFM
@@ -331,7 +331,12 @@ CLA = `80` (GlobalPlatform v2.3.1). Удалённое управление со
Вставьте сырой hex APDU — отобразится раскрывающееся дерево. Контейнер определяется автоматически: **Expanded Script** (ведущие `AA` или `AE80`, разбор по ETSI TS 102 226 §5.2.1) или **компактная цепочка C-APDU** (последовательность ISO 7816 C-APDU). У каждого узла — метка, hex и краткое описание; родительские узлы раскрываются до подэлементов.
-### HTTP OTA
+### Пуш/триггер
+
+Объединяет команды, заставляющие карту выйти в сеть: триггер административной сессии HTTP (GlobalPlatform) с режимом записи параметров и варианты команды PUSH из ETSI TS 102 226 §9. Доставляются они по-разному — триггер администрирования это TLV-сообщение для Security Domain, а PUSH §9 это C-APDU (`80 EC 01 P2`) для приложения с поддержкой BIP/CAT_TP.
+
+#### Сессия администрирования (HTTP OTA)
+
Сборка payload-ов Remote Application Management over HTTP по GlobalPlatform **GPC v2.2 Amendment B v1.1** (§4.7). Два режима:
@@ -347,6 +352,13 @@ CLA = `80` (GlobalPlatform v2.3.1). Удалённое управление со
Чекбокс **Command Scripting template** оборачивает всю команду `81` в формат Expanded Remote Application с определённой длиной (`AA`, ETSI TS 102 226 §5.2.1) для TAR, обрабатывающих расширенный формат. **Pack into Secured packet** отправляет собранный payload на вкладку SCP80 для заполнения SPI/счётчика — укажите там TAR, который слушает SD (обычно OTASD).
+#### PUSH по TS 102 226 §9
+
+Два управляемых раздела собирают запросы §9 тем же кодировщиком, что и строка **PUSH** в цепочке RAM/GP, и предлагают **«Упаковать в Secured packet»** (TAR остаётся ручным — запрос адресован целевому приложению) и **→ Расширенный скрипт** (оборачивает APDU в Command TLV `22`):
+
+- **BIP / CAT_TP** — `01` открытие BIP-канала (COMPREHENSION-TLV OPEN CHANNEL необязательны) или `02` CAT_TP (порт назначения в transport level `3C` с типом 00, необязательные buffer size `39` / данные идентификации `36`);
+- **TCP** — `03` TCP-соединение (bearer `35`, transport level `3C` с типом 02, адрес назначения `3E` — `21` IPv4 / `57` IPv6 / `F0` FQDN, NAA/APN `47`) или `04` пакет идентификации (по уже открытому каналу, при отсутствии данных используется ICCID).
+
---
diff --git a/frontend/help-ru.html b/frontend/help-ru.html
index c39c7a7..6cddaf3 100644
--- a/frontend/help-ru.html
+++ b/frontend/help-ru.html
@@ -230,7 +230,10 @@
2.6 Разбор C-APDU
Вставка raw APDU hex и отображение сворачиваемого дерева. Автоматически определяет контейнер: Expanded Script (начало AA или AE80, декодируется по ETSI TS 102 226 §5.2.1) или Compact C-APDU chain (последовательность C-APDU ISO 7816). Каждый узел показывает метку, hex и краткое описание; родительские узлы раскрываются в подэлементы.
Объединяет команды, заставляющие карту выйти в сеть: триггер административной сессии HTTP (GlobalPlatform) с режимом записи параметров и варианты команды PUSH из ETSI TS 102 226 §9 (открытие BIP-канала, соединение CAT_TP, TCP-соединение, пакет идентификации). Они из разных спецификаций и доставляются по-разному — триггер администрирования это TLV-сообщение для Security Domain, а PUSH §9 это C-APDU (80 EC 01 P2) для приложения с поддержкой BIP и/или CAT_TP.
Сборка payload’ов Remote Application Management over HTTP по GlobalPlatform GPC v2.2 Amendment B v1.1 (§4.7). Два режима:
81 > 83 > 84/[85]/[86]/89, таблица 4-3). Сообщение, которое просит Security Domain карты исходящим запросом начать HTTP-сессию.Флажок Обёртка в Command Scripting template ('AA') оборачивает всю команду 81 в формат Expanded Remote Application data с определённой длиной (AA, ETSI TS 102 226 §5.2.1) для TAR-ов, обрабатывающих расширенный формат (RAM-over-HTTP §4.7).
Упаковать в Secured packet отправляет готовый payload на вкладку SCP80 для заполнения SPI/счётчика — там укажите TAR, который слушает SD (обычно TAR OTASD).
+Два раздела собирают запросы §9 тем же кодировщиком, что и строка PUSH в цепочке RAM/GP, показывают предпросмотр C-APDU и предлагают «Упаковать в Secured packet» (TAR остаётся ручным: запрос адресован целевому приложению, а не Security Domain) и → Расширенный скрипт (оборачивает APDU в Command TLV 22 и добавляет его в конструктор Expanded Script).
01 открытие BIP-канала (необязательные COMPREHENSION-TLV OPEN CHANNEL; при пустом значении действуют умолчания приложения) или 02 установление соединения CAT_TP (порт назначения в transport level 3C с типом протокола 00, необязательные buffer size 39 / данные идентификации 36).03 TCP-соединение (bearer 35, transport level 3C с типом протокола 02 = TCP-клиент, удалённое соединение, адрес назначения 3E с типом 21 IPv4 / 57 IPv6 / F0 FQDN, NAA/APN 47) или 04 пакет идентификации (необязательные данные, при отсутствии используется ICCID — отправляется по уже открытому TCP-каналу, не триггер).02 нужен порт назначения, для 03 — порт и адрес назначения. Строка PUSH в цепочке RAM/GP остаётся нестрогой для свободного составления скриптов.Pastes raw APDU hex and renders a collapsible tree. It auto-detects the container: an Expanded Script (leading AA or AE80, decoded per ETSI TS 102 226 §5.2.1) or a Compact C-APDU chain (a sequence of ISO 7816 C-APDUs). Each node shows its label, hex and a short description; parent nodes expand to reveal their sub-elements.
Groups the commands that make the card dial out: the GlobalPlatform HTTP administration session trigger (and its Store mode) plus the ETSI TS 102 226 §9 PUSH variants (BIP channel opening, CAT_TP link, TCP connection, identification packet). They come from different specs and are delivered differently — the administration trigger is a TLV message for the Security Domain, a §9 PUSH is a C-APDU (80 EC 01 P2) for an application that supports BIP and/or CAT_TP.
Builds the Remote Application Management over HTTP payloads defined in GlobalPlatform GPC v2.2 Amendment B v1.1 (§4.7). Two modes:
81 > 83 > 84/[85]/[86]/89, Table 4-3). This is the message that asks the card's Security Domain to dial out and start an HTTP session.Command Scripting template (checkbox) wraps the whole 81 triggering command in the definite-length Expanded Remote Application data format (AA, ETSI TS 102 226 §5.2.1) for TARs that process the expanded format (RAM-over-HTTP §4.7).
Pack into Secured packet sends the built payload to the SCP80 tab for SPI/counter filling — insert the TAR the SD listens on (typically the OTASD TAR) there.
+Two guided sections build the §9 requests with the same encoder as the RAM/GP chain's PUSH row, preview the C-APDU, and offer Pack into Secured packet (the TAR stays manual: the request is addressed to the target application, not the Security Domain) and → Expanded Script (wraps the APDU in the 22 Command TLV and appends it to the Expanded Script builder).
01 BIP channel opening (optional OPEN CHANNEL COMPREHENSION-TLVs; the application defaults apply when empty) or 02 CAT_TP link establishment (destination port in transport level 3C with protocol type 00, optional buffer size 39 / identification data 36).03 TCP connection (bearer 35, transport level 3C with protocol type 02 = TCP client remote, destination address 3E with type 21 IPv4 / 57 IPv6 / F0 FQDN, NAA/APN 47) or 04 identification packet (optional data, ICCID when absent — sent over an already open TCP channel, not a trigger).02 needs the destination port, 03 the port and the destination address. The RAM/GP chain row keeps the lenient behaviour for free-form scripting.Not the administration session — a C-APDU for an app that supports BIP/CAT_TP
+Not the administration session — a C-APDU for an app that supports BIP/CAT_TP
+