Skip to main content

Module command

Module command 

Source
Expand description

GlobalPlatform APDU builders — PDD §5 (pure; §3.5).

Each submodule builds the C-APDU plaintext; SCP wrapping (CLA | 0x04, C-MAC, optional C-ENC) is applied later by the session/backend. Verified wire values are documented per submodule against GPCS v2.3.1 §11.

no_std: builders return a fixed-capacity Capdu instead of Vec<u8>. Because a heapless push is fallible, the builders are total — oversized input returns BuildError::Overflow rather than panicking (the no-panic invariant, §10.5) — so each now returns Result<Capdu, BuildError>.

All builders share the [build] short-APDU framer and the [push] / [push_lv] helpers below (private to this module; visible to the submodules). build lays out the ISO/IEC 7816-4:2020 §5.1 short-APDU cases: empty data ⇒ no Lc (Case 1/2), le ⇒ a trailing Le = 00 (“all available”). Only SET STATUS omits Le (Case 1/3, Table 11-85).

Modules§

delete
DELETE (CLA 84, INS E4) — PDD §5.3.3 (key) / §5.5 / §5.8 (object), GPCS §11.2.
get_data
GET DATA (CLA 80, INS CA) — PDD §5.2.
get_status
GET STATUS (CLA 80, INS F2) — PDD §5.12, GPCS v2.3.1 §11.4.
install
INSTALL (CLA 84, INS E6) — PDD §5.4/§5.4a/§5.6/§5.7, GPCS §11.5.
load
LOAD (CLA 84, INS E8) — PDD §5.4a, GPCS v2.3.1 §11.6.
put_key
PUT KEY (CLA 84, INS D8) — PDD §5.3.1, GPCS v2.3.1 §11.8.
rmac_session
BEGIN / END R-MAC SESSION (CLA 80, INS 7A / 78) — SCP02 response integrity.
select
SELECT (CLA 00, INS A4, P1 04, P2 00) — PDD §5.2/§5.9.
set_status
SET STATUS (CLA 84, INS F0) — PDD §5.11, GPCS v2.3.1 §11.10.

Enums§

BuildError
Command-builder failure. Builders are total (no panic on any input): inputs that would exceed the short-APDU buffer return Overflow.

Type Aliases§

Capdu
A built short C-APDU plaintext buffer (≤ CAPDU_MAX). SCP wrapping (C-MAC, optional C-ENC) is applied later by the session, which may grow it — still within CAPDU_MAX for short APDUs.