CLA = A0 (GSM 11.11 / TS 151 011, ISO 7816-4). Удалённое управление файлами классических SIM-карт.
-
Команды собираются в виде цепочки: нажмите кнопку + SELECT (или другую командную кнопку), чтобы добавить строку, заполните её поля — предпросмотр цепочки (над кнопкой упаковки) обновится автоматически. Добавьте строку GET RESPONSE, чтобы получить данные после SELECT. Кнопка Упаковать в Secured packet упаковывает всю цепочку в пакет SCP80.
+
Команды собираются в виде цепочки: нажмите кнопку + SELECT (или другую командную кнопку), чтобы добавить строку, заполните её поля — предпросмотр цепочки (над кнопкой упаковки) обновится автоматически. Добавьте строку GET RESPONSE, чтобы получить данные после SELECT. Кнопка Упаковать в Secured packet упаковывает всю цепочку в пакет SCP80 и устанавливает TAR SCP80 в UICC TAR выбранной предустановки (по умолчанию B00000). Текущий DF сессии SIM RFM — MF, поэтому пути SELECT адресуют файлы от MF.
Команда
INS
Описание
@@ -95,7 +95,8 @@
CLA = 00 (ETSI TS 102 221). Тот же сборщик цепочки и набор команд, что и SIM. Отличия:
SELECT по умолчанию запрашивает FCP (P2=04) и добавляет Le=00; флажок Silent (P2=0C) выбирает файл без запроса FCP (без Le, без данных ответа).
-
По пути предлагает выбор from MF (P1=08) или from current DF (P1=09).
+
По пути предлагает выбор from MF (P1=08) или from current DF (P1=09); текущий DF сессии USIM RFM — ADF.USIM.
+
Упаковать в Secured packet устанавливает TAR SCP80 в USIM TAR выбранной предустановки (по умолчанию B00001).
Каждый переход SELECT в цепочке запрашивает FCP, если не отмечен как silent.
@@ -275,7 +276,7 @@
Кнопка Проверить в pySim сверяет собранный пакет с эталонной реализацией OtaDialectSms.encode_cmd. Кнопка Отправить на карту доставляет пакет через ENVELOPE SMS-PP-DOWNLOAD (при подключении к серверу). Полученный Proof of Receipt декодируется и показывается строкой статуса PoR (статус, TAR, счётчик, сырой PoR); статусное слово и данные ответа последней команды подставляются в подвкладку «Парсер ответов» (Remote APDU), а успешный PoR увеличивает счётчик повторов и очищает пакет.
3.2 RAM
-
Выполняет операции удалённого управления приложениями (Remote Application Management) как защищённые пакеты SCP80 через SMS-PP-DOWNLOAD ENVELOPE. Карта должна поддерживать SCP03 (AES или 3DES). Предустановка карты со вкладки Карты обеспечивает SPI, ключи, TAR и счётчик.
+
Выполняет операции удалённого управления приложениями (Remote Application Management) как защищённые пакеты SCP80 через SMS-PP-DOWNLOAD ENVELOPE. Карта должна поддерживать SCP03 (AES или 3DES). Предустановка карты со вкладки Карты обеспечивает SPI, ключи, TAR и счётчик (RAM использует ISD TAR предустановки, по умолчанию 000000).
Операции
@@ -298,22 +299,25 @@
4. Вкладка «Карты»
-
Хранит предустановки карт локально в браузере (localStorage), чтобы представление Secured Packet могло автоматически подставлять ключи и параметры, а слушатель SCP81 HTTP OTA — находить PSK-ключи. «Карты» — верхнеуровневая вкладка. При подключении карты читается её EF.ICCID, и предустановка с тем же ICCID автоматически выбирается в обоих представлениях SCP80. Поля формы сгруппированы в два блока с рамкой: SCP80 (GSM 03.48, ETSI TS 102 225) (KIc/KID, SPI1/SPI2, TAR, счётчик и ключи) и SCP81 (HTTP OTA) (пара PSK identity/ключ с пояснением о выборе ключа).
+
Хранит предустановки карт локально в браузере (localStorage), чтобы представление Secured Packet могло автоматически подставлять ключи и параметры, а слушатель SCP81 HTTP OTA — находить PSK-ключи. «Карты» — верхнеуровневая вкладка. При подключении карты читается её EF.ICCID, и предустановка с тем же ICCID автоматически выбирается в обоих представлениях SCP80. Поля формы сгруппированы в два блока с рамкой: SCP80 (GSM 03.48, ETSI TS 102 225) (KIc/KID, SPI1/SPI2, TAR-ы ISD/UICC/USIM, счётчик и ключи) и SCP81 (HTTP OTA) (пара PSK identity/ключ с пояснением о выборе ключа). Необязательное поле ADM находится в верхней строке и сохраняется для последующего использования файловым менеджером.
Поле
Описание
Name
Понятная метка (обязательна)
ICCID
Опциональный идентификатор карты. Кнопка С карты подставляет EF.ICCID подключённой карты (активна, только когда ICCID читается); при сохранении ICCID, уже присутствующий в списке, отклоняется (сравнение без пробелов и с учётом сырой hex-формы, конфликтующий пресет называется)
+
ADM
Необязательный администраторский PIN (hex или до 8 ASCII-цифр), сохраняется в предустановке для последующего использования файловым менеджером; представлениями SCP80/SCP81 не используется
KIc / KID
Индикаторы ключа и алгоритма (например, 15 = индекс 1, 3DES-CBC2; x2 = AES); задаются вместе с ключами
SPI1 / SPI2
Security Parameter Indicators
-
TAR
Toolkit Application Reference
+
ISD TAR
Toolkit Application Reference для операций ISD/RAM (представление SCP80 RAM, цепочки RAM/GP); по умолчанию по спецификации 000000, подставляется при пустом значении
+
UICC TAR
TAR для SIM RFM (TS 31.116); по умолчанию B00000 — сессия SIM RFM выбирает файлы от MF
+
USIM TAR
TAR для USIM RFM (TS 31.115); по умолчанию B00001 — текущий DF сессии USIM RFM — ADF.USIM
Counter
Счётчик повторов (5 байт); увеличивается и сохраняется после каждой успешной отправки SCP80
SCP81 HTTP OTA: идентификатор, который карта присылает в TLS-рукопожатии (например, 89390100000129506903)
PSK key
SCP81 HTTP OTA: 32 hex-символа (16 байт) для PSK TLS-слушателя; ключ выбирается по идентификатору, который предъявляет карта
-
Столбец SCP81 показывает, задана ли в предустановке рабочая пара PSK: ✓ (зелёный) — идентификатор и ключ заданы; ⚠ (жёлтый) — задано только одно из двух, и слушатель такую предустановку игнорирует; — — PSK нет. Идентификатор и ключ PSK задаются вместе. Кнопка Редактировать загружает предустановку в форму (кнопка Add становится Сохранить; Отмена очищает форму), поэтому поля можно менять без повторного ввода карты; Удалить удаляет строку. Обмен предустановками: Экспорт в файл для выгрузки и Импорт из файла для загрузки. Выбранная предустановка автоматически заполняет форму Secured Packet; изменения сразу передаются работающему слушателю SCP81.
+
Столбец SCP81 показывает, задана ли в предустановке рабочая пара PSK: ✓ (зелёный) — идентификатор и ключ заданы; ⚠ (жёлтый) — задано только одно из двух, и слушатель такую предустановку игнорирует; — — PSK нет. Идентификатор и ключ PSK задаются вместе. Кнопка Редактировать загружает предустановку в форму (кнопка Add становится Сохранить; Отмена очищает форму), поэтому поля можно менять без повторного ввода карты; Удалить удаляет строку. Обмен предустановками: Экспорт в файл для выгрузки и Импорт из файла для загрузки. Выбранная предустановка автоматически заполняет форму Secured Packet и устанавливает TAR для операции (RAM/GP → ISD TAR, SIM RFM → UICC TAR, USIM RFM → USIM TAR); изменения сразу передаются работающему слушателю SCP81.
CLA = A0 (GSM 11.11 / TS 151 011, ISO 7816-4). Remote File Management for classic SIM cards.
-
Commands are assembled as a chain: press a command button (e.g. + SELECT) to append a row, fill that row’s fields, and the chain preview (above the pack button) updates automatically. Add a GET RESPONSE row to fetch data following a SELECT. Press Pack into Secured packet to wrap the whole chain into an SCP80 packet.
+
Commands are assembled as a chain: press a command button (e.g. + SELECT) to append a row, fill that row’s fields, and the chain preview (above the pack button) updates automatically. Add a GET RESPONSE row to fetch data following a SELECT. Press Pack into Secured packet to wrap the whole chain into an SCP80 packet; packing sets the SCP80 TAR to the selected preset’s UICC TAR (B00000 by default). A SIM RFM session’s current DF is MF, so SELECT paths address files from MF.
Command
INS
Description
@@ -95,7 +95,8 @@
CLA = 00 (ETSI TS 102 221). Same chain builder and command set as SIM. Differences:
SELECT requests FCP by default (P2=04) and appends Le=00; a Silent (P2=0C) checkbox selects without requesting FCP (no Le, no response data).
-
By path offers from MF (P1=08) or from current DF (P1=09).
+
By path offers from MF (P1=08) or from current DF (P1=09); the current DF of a USIM RFM session is ADF.USIM.
+
Pack into Secured packet sets the SCP80 TAR to the selected preset’s USIM TAR (B00001 by default).
Each SELECT hop in a chain requests FCP unless marked silent.
@@ -275,7 +276,7 @@
A “Verify vs pySim” button cross-checks the assembled packet against pySim’s reference OtaDialectSms.encode_cmd. A “Send to Card” button delivers it via SMS-PP-DOWNLOAD ENVELOPE (when connected to the server). The returned Proof of Receipt is decoded and shown as a PoR status line (status, TAR, counter, raw PoR); the last command’s status word and response data are filled into the Response parser tab, and a successful PoR advances the replay counter and clears the packet.
3.2 RAM
-
Delivers Remote Application Management operations as SCP80 secured packets via SMS-PP-DOWNLOAD ENVELOPE. The card must support SCP03 (AES or 3DES). A saved card preset from the Cards tab provides the SPI, keys, TAR, and counter.
+
Delivers Remote Application Management operations as SCP80 secured packets via SMS-PP-DOWNLOAD ENVELOPE. The card must support SCP03 (AES or 3DES). A saved card preset from the Cards tab provides the SPI, keys, TAR, and counter (RAM uses the preset's ISD TAR, 000000 by default).
Operations
@@ -298,22 +299,25 @@
4. Cards tab
-
Stores card presets locally in the browser (localStorage) so the Secured Packet view can auto-fill keys and parameters, and so the SCP81 HTTP OTA listener can look up PSK keys. Cards is a top-level tab. When the card is equipped its EF.ICCID is read and the preset with the same ICCID is selected automatically in both SCP80 views. The form groups the fields into two bordered blocks: SCP80 (GSM 03.48, ETSI TS 102 225) (KIc/KID, SPI1/SPI2, TAR, counter and keys) and SCP81 (HTTP OTA) (the PSK identity/key pair with the key-selection note).
+
Stores card presets locally in the browser (localStorage) so the Secured Packet view can auto-fill keys and parameters, and so the SCP81 HTTP OTA listener can look up PSK keys. Cards is a top-level tab. When the card is equipped its EF.ICCID is read and the preset with the same ICCID is selected automatically in both SCP80 views. The form groups the fields into two bordered blocks: SCP80 (GSM 03.48, ETSI TS 102 225) (KIc/KID, SPI1/SPI2, the ISD/UICC/USIM TARs, counter and keys) and SCP81 (HTTP OTA) (the PSK identity/key pair with the key-selection note). The optional ADM field sits in the top row and is stored for later use by the file manager.
Field
Description
Name
Human-readable label (required)
ICCID
Optional card identifier. From card fills it with the equipped card's EF.ICCID (enabled only while a readable ICCID is known); saving refuses an ICCID that already exists in the list (compared ignoring spaces and the raw-hex form, and the conflicting preset is named)
+
ADM
Optional administrator PIN (hex, or up to 8 ASCII digits), stored in the preset for later use by the file manager; not used by the SCP80/SCP81 views
KIc / KID
Key and algorithm indicators (e.g. 15 = index 1, 3DES-CBC2; x2 = AES), required together with the keys
SPI1 / SPI2
Security Parameter Indicators
-
TAR
Toolkit Application Reference
+
ISD TAR
Toolkit Application Reference for ISD/RAM operations (SCP80 RAM view, RAM/GP chains); spec default 000000, prefilled when empty
+
UICC TAR
TAR for SIM RFM (TS 31.116); spec default B00000 — a SIM RFM session selects from MF
+
USIM TAR
TAR for USIM RFM (TS 31.115); spec default B00001 — a USIM RFM session's current DF is ADF.USIM
Counter
Replay counter (5 bytes); advanced and saved after each successful SCP80 send
SCP81 HTTP OTA: the identity the card sends in the TLS handshake (e.g. 89390100000129506903)
PSK key
SCP81 HTTP OTA: 32 hex chars (16 bytes) for the PSK TLS listener, picked by the identity the card presents
-
The SCP81 column shows whether the preset supplies a usable PSK pair: ✓ (green) — identity and key set; ⚠ (amber) — only one of the two, so the listener ignores the preset; — — no PSK. PSK identity and key must be set together. Edit loads a preset into the form (the Add button becomes Save; Cancel clears it) so fields can be changed without re-entering the card; Remove deletes the row. Presets can be shared with Export to file and restored with Import from file. The selected card preset auto-fills the Secured Packet form; edits are pushed into a running SCP81 listener automatically.
+
The SCP81 column shows whether the preset supplies a usable PSK pair: ✓ (green) — identity and key set; ⚠ (amber) — only one of the two, so the listener ignores the preset; — — no PSK. PSK identity and key must be set together. Edit loads a preset into the form (the Add button becomes Save; Cancel clears it) so fields can be changed without re-entering the card; Remove deletes the row. Presets can be shared with Export to file and restored with Import from file. The selected card preset auto-fills the Secured Packet form and sets the TAR for the operation (RAM/GP → ISD TAR, SIM RFM → UICC TAR, USIM RFM → USIM TAR); edits are pushed into a running SCP81 listener automatically.
@@ -1384,7 +1387,7 @@
// ===== Version =====
// Single source of truth for the PWA version: shown in the header and used
// by the server version check in pysimConnect().
-const SIMPLE_VERSION = '2.5.2';
+const SIMPLE_VERSION = '2.6.0';
document.getElementById('app-version').textContent = 'v' + SIMPLE_VERSION;
// ===== Tab switching =====
@@ -2045,7 +2048,7 @@ function chainSimFieldsHtml(chainId, idx, f, uf) {
'';
if (chainId === 'chain-usim') {
html += '
' +
- '
';
+ '
';
}
html += '';
}
@@ -2855,12 +2858,36 @@ async function ramQueueScp81() {
}
}
+// Which TAR of the selected preset feeds the SCP80 form: RAM/GP -> ISD,
+// SIM RFM -> UICC, USIM RFM -> USIM (spec defaults when the value is empty).
+let _spTarKey = 'tar';
+
+function spTarKeyForPack(sourceId) {
+ return {
+ 'chain-ram-preview': 'tar',
+ 'chain-sim-preview': 'uiccTar',
+ 'chain-usim-preview': 'usimTar',
+ }[sourceId] || null;
+}
+
+function spPresetTar(key) {
+ const sel = document.getElementById('sp-card-sel');
+ const idx = sel ? parseInt(sel.value, 10) : NaN;
+ const c = (!isNaN(idx) && cards[idx]) ? cards[idx] : null;
+ return cardsTarValue(key, c ? c[key] : '');
+}
+
function packToSp(sourceId) {
const val = document.getElementById(sourceId).value;
if (!val) return;
switchTab('scp80');
scp80SwitchSubtab('sp');
document.getElementById('sp-apdu').value = val;
+ const key = spTarKeyForPack(sourceId);
+ if (key) {
+ _spTarKey = key;
+ document.getElementById('sp-tar').value = spPresetTar(key);
+ }
}
function spCntrAdjust(delta) {
const el = document.getElementById('sp-cntr');
@@ -5318,6 +5345,7 @@ function ramApplyCard(idx) {
// getRamSpParams() picks up the right SPI/KIc/KID/TAR/CNTR/keys
const i = parseInt(idx, 10);
if (!isNaN(i) && cards[i]) _ramCardIdx = i;
+ _spTarKey = 'tar'; // RAM/GP operations target the ISD
cardsApply(idx);
}
@@ -6087,6 +6115,13 @@ function cardsPskName(identity) {
return c ? c.name : '';
}
+// Spec-default TARs (GP ISD 000000, TS 31.116 UICC B00000, TS 31.115 USIM
+// B00001): an empty preset value means the default for that target.
+function cardsTarValue(key, value) {
+ const defaults = { tar: '000000', uiccTar: 'B00000', usimTar: 'B00001' };
+ return value || defaults[key] || '';
+}
+
function cardsFormValues() {
const val = id => {
const el = document.getElementById('cards-' + id);
@@ -6095,11 +6130,14 @@ function cardsFormValues() {
return {
name: val('name'),
iccid: val('iccid'),
+ adm: val('adm').replace(/\s/g, '').toUpperCase(),
kic: val('kic'),
kid: val('kid'),
spi1: val('spi1'),
spi2: val('spi2'),
tar: val('tar'),
+ uiccTar: val('uicc-tar'),
+ usimTar: val('usim-tar'),
cntr: val('cntr'),
kicKey: val('kic-key'),
kidKey: val('kid-key'),
@@ -6116,15 +6154,24 @@ function cardsSetFormMode() {
}
function cardsClearForm() {
- ['name','iccid','kic','kid','spi1','spi2','tar','cntr','kic-key','kid-key',
+ ['name','iccid','adm','kic','kid','spi1','spi2','cntr','kic-key','kid-key',
'psk-id','psk-key'].forEach(id => {
const el = document.getElementById('cards-' + id);
if (el) el.value = '';
});
+ // TARs keep their per-target spec defaults instead of being emptied
+ [['tar','tar'],['uicc-tar','uiccTar'],['usim-tar','usimTar']].forEach(([id, key]) => {
+ const el = document.getElementById('cards-' + id);
+ if (el) el.value = cardsTarValue(key, '');
+ });
}
function cardsAdd() {
const v = cardsFormValues();
+ // empty TAR fields fall back to the per-target spec defaults
+ v.tar = cardsTarValue('tar', v.tar);
+ v.uiccTar = cardsTarValue('uiccTar', v.uiccTar);
+ v.usimTar = cardsTarValue('usimTar', v.usimTar);
if (!v.name) { alert(t('Name is required')); return; }
if (!v.kic || !v.kid) { alert('KIc and KID are required'); return; }
if (!v.kicKey || !v.kidKey) { alert('KIc key and KID key are required'); return; }
@@ -6162,8 +6209,11 @@ function cardsEdit(i) {
const el = document.getElementById('cards-' + id);
if (el) el.value = value == null ? '' : value;
};
- set('name', c.name); set('iccid', c.iccid); set('kic', c.kic); set('kid', c.kid);
- set('spi1', c.spi1); set('spi2', c.spi2); set('tar', c.tar); set('cntr', c.cntr);
+ set('name', c.name); set('iccid', c.iccid); set('adm', c.adm); set('kic', c.kic); set('kid', c.kid);
+ set('spi1', c.spi1); set('spi2', c.spi2); set('cntr', c.cntr);
+ set('tar', cardsTarValue('tar', c.tar));
+ set('uicc-tar', cardsTarValue('uiccTar', c.uiccTar));
+ set('usim-tar', cardsTarValue('usimTar', c.usimTar));
set('kic-key', c.kicKey); set('kid-key', c.kidKey);
set('psk-id', c.pskIdentity); set('psk-key', c.pskKey);
cardsSetFormMode();
@@ -6213,7 +6263,7 @@ function cardsRender() {
html += '