diff --git a/README.md b/README.md index 45748bc..f27486c 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,22 @@ Error Action supports the same builder (DISPLAY TEXT, PLAY TONE). CLA = `80` (GlobalPlatform Card Specification v2.3.1). Remote Application Management operations for card content management over SCP80. +All RAM operations are delivered as SCP80 secured packets (ETSI TS 102 225) via SMS-PP-DOWNLOAD ENVELOPE. The card must support SCP03 (AES or 3DES) for secure transport. + +### Card Preset + +Select a saved card configuration from the **Card preset** dropdown. Each preset stores: + +| Field | Description | +|---|---| +| SPI1 / SPI2 | Security level and PoR settings | +| KIc / KID key | Encryption and MAC key hex | +| KIc / KID index | Key version number | +| TAR | Toolkit Application Reference (3 bytes) | +| Counter (CNTR) | 10-digit hex replay counter, auto-incremented after each successful SCP80 send | + +Card presets are managed in the **SCP80 → Cards** subtab (see below). If no preset is selected, the RAM tab warns and refuses to execute. + ### Operations The RAM subtab offers two operations selected from the **Operation** dropdown: @@ -362,6 +378,29 @@ SPI1 bit layout (TS 102 225 §5.1.1): `b8–b6` padding, `b5–b4` counter, `b3` - ISO 9797-1: MAC algorithms - NIST SP 800-38B: CMAC +### PoR (Proof of Reception) + +PoR confirms the card received and executed the secured packet. Two modes: + +| SPI2 (bit 5) | Mode | Description | +|---|---|---| +| `0x00` | Delivery PoR | PoR is returned in the ENVELOPE response SW+data | +| `0x20` | Submit PoR | PoR is sent back as an SMS-SUBMIT via a proactive FETCH command | + +Delivery PoR (SPI2 `01`) is simpler — the card returns the PoR directly in the ENVELOPE response. Submit PoR (SPI2 `21`) is used when the card cannot respond inline (e.g. during ELF operations where the ENVELOPE response space is limited). + +### Cards Subtab + +The **Cards** pill in the SCP80 tab manages saved card configurations (presets). Each preset stores the cryptographic keys, SPI settings, TAR, and replay counter needed for SCP80 operations. + +**Add a card:** fill in the name, SPI1/SPI2, KIc/KID keys and indices, TAR, and click **Add**. The card appears in the list and becomes available in the RAM tab's **Card preset** dropdown. + +**Edit a card:** click a card in the list, modify fields, click **Save**. + +**Delete a card:** select a card, click **Delete**. Removes the preset from `localStorage`. + +**Counter:** the 10-digit hex counter (CNTR) is auto-incremented after each successful SCP80 send (both manual Secured Packet sends and RAM operations). The updated counter is saved back to the preset automatically. + --- ## Conversion (SIM/USIM sidebars) diff --git a/README_RUS.md b/README_RUS.md index 5ceb5a9..028126f 100644 --- a/README_RUS.md +++ b/README_RUS.md @@ -129,6 +129,22 @@ CLA = `00` (ETSI TS 102 221). Те же команды, что и SIM, но SELE CLA = `80` (GlobalPlatform v2.3.1). Удалённое управление содержимым карты через SCP80. +Все операции RAM отправляются как защищённые пакеты SCP80 (ETSI TS 102 225) через SMS-PP-DOWNLOAD ENVELOPE. Карта должна поддерживать SCP03 (AES или 3DES) для безопасной транспортировки. + +### Выбор карты (Card Preset) + +Выберите сохранённую конфигурацию карты из выпадающего списка **Card preset**. Каждый пресет хранит: + +| Поле | Описание | +|---|---| +| SPI1 / SPI2 | Уровень безопасности и настройки PoR | +| Ключ KIc / KID | Hex ключи шифрования и MAC | +| Индекс KIc / KID | Номер версии ключа | +| TAR | Toolkit Application Reference (3 байта) | +| Счётчик (CNTR) | 10-значный hex счётчик повторов, автоматически увеличивается после каждой успешной отправки SCP80 | + +Пресеты карт управляются во вкладке **SCP80 → Cards** (см. ниже). Если пресет не выбран, RAM-вкладка предупреждает и отказывается выполнять. + ### Операции В RAM-подвкладке доступны две операции через выпадающий список **Operation**: @@ -346,6 +362,29 @@ CLA = `80` (GlobalPlatform v2.3.1). Удалённое управление со - ISO 9797-1 - NIST SP 800-38B (CMAC) +### Подвкладка Cards + +Пилл **Cards** во вкладке SCP80 управляет сохранёнными конфигурациями карт (пресеты). Каждый пресет хранит криптографические ключи, настройки SPI, TAR и счётчик повторов для SCP80-операций. + +**Добавить карту:** заполните имя, SPI1/SPI2, ключи KIc/KID и их индексы, TAR, нажмите **Add**. Карта появится в списке и станет доступна в выпаданом списке **Card preset** на RAM-вкладке. + +**Редактировать карту:** выберите карту в списке, измените поля, нажмите **Save**. + +**Удалить карту:** выберите карту, нажмите **Delete**. Удаляет пресет из `localStorage`. + +**Счётчик:** 10-значный hex-счётчик (CNTR) автоматически увеличивается после каждой успешной отправки SCP80 (ручные отправки Secured Packet и RAM-операции). Обновлённый счётчик автоматически сохраняется обратно в пресет. + +### PoR (Proof of Reception) + +PoR подтверждает, что карта получила и выполнила защищённый пакет. Два режима: + +| SPI2 (бит 5) | Режим | Описание | +|---|---|---| +| `0x00` | Delivery PoR | PoR возвращается в ответе ENVELOPE (SW+данные) | +| `0x20` | Submit PoR | PoR отправляется обратно как SMS-SUBMIT через прокоманду FETCH | + +Delivery PoR (SPI2 `01`) проще — карта возвращает PoR напрямую в ответе ENVELOPE. Submit PoR (SPI2 `21`) используется, когда карта не может ответить inline (ограничено пространство ответа ENVELOPE). + --- ## Конвертация (боковые панели SIM/USIM) diff --git a/docs/api.md b/docs/api.md index e45e41b..beccea2 100644 --- a/docs/api.md +++ b/docs/api.md @@ -32,7 +32,6 @@ connect and warns if versions are incompatible. | `/api/send-ota` | POST | SCP80 OTA secured packet delivery | | `/api/ram-install` | POST | Install a Java Card `.cap` file via SCP80 (INSTALL[for load] → LOAD ×N → INSTALL[for install]) | | `/api/sp-verify` | POST | Verify secured packet against pySim reference | -| `/api/ram-install` | POST | Install a Java Card `.cap` file via SCP80 (INSTALL[for load] → LOAD ×N → INSTALL[for install]) | | `/api/menu` | GET | Current STK menu (title + items + active) | | `/api/menu-select` | POST | ENVELOPE(Menu Selection) with item_id | | `/api/menu-respond` | POST | TERMINAL RESPONSE for paused STK command |