Skip to main content

Module response

Module response 

Source
Expand description

Card-response parsers — PDD §5.2 (discover) and §5.12 (get_card_status).

Pure, fuzzable (§10.5 target #2): these consume bytes a malicious or buggy card controls, so every function is total — malformed input yields a typed TlvError, never a panic (no unwrap on a bounded heapless push). They sit one layer above crate::tlv: each walks the BER-TLV template and decodes it into the public crate::model / crate::report types.

Four templates, all decoded here:

  • Card Recognition Data '66' → advertised SCP variants (GPCS v2.3.1 §H.2 — the '64' OID’s last two octets are scp_id/i).
  • Key Information Template '00E0' → keysets grouped by KVN (GPCS v2.3.1 §11.3.3.1).
  • Card Capability Information '67'CardCapabilities (GPCS v2.3.1 §H.4).
  • GET STATUS GP Registry entry 'E3'CardLifeCycle (GPCS v2.3.1 §11.4, Table 11-36; life-cycle byte is '9F70').

Absent vs malformed. A missing optional element is not an error: it yields an empty list / None / the documented default, and the discovery workflow (§5.2) turns that into a crate::error::WarningKind, not a hard failure. Only a structurally broken template (a real BER-TLV violation, or more objects than the bounded model can hold) is reported as TlvError. Unknown semantic bytes (an unrecognised key type or life-cycle byte) are absorbed into the model’s Other / Unknown variants, never errors.

Structs§

CardRecognition
Advertised secure-channel capability decoded from Card Recognition Data. scp[0] is the card’s default (first '64' listed); the discovery workflow applies the §4.3 selection rule over the full list.
KeyInformation
Decoded Key Information Template: keysets grouped by Key Version Number. format is KeyTemplateFormat::Extended if any entry used the 'B9' sub-template, else KeyTemplateFormat::Basic.
RegistryEntry
One decoded GlobalPlatform Registry 'E3' entry — the scope-agnostic shape the get_card_inventory workflow (§5.12a) maps into the typed crate::model entries (Security Domain / Application / ELF).

Functions§

parse_card_capabilities
Parse Card Capability Information (value of GET DATA '67'; GPCS §H.4).
parse_card_recognition
Parse Card Recognition Data (the value of GET DATA '66'; GPCS §H.2).
parse_key_information
Parse the Key Information Template (value of GET DATA '00E0'; §11.3.3.1).
parse_status_e3
Parse the single ISD GlobalPlatform Registry entry from a GET STATUS response and decode its life-cycle byte ('E3''9F70'; Table 11-36 / Table 11-6).
parse_status_registry
Parse one GET STATUS page into its 'E3' registry entries (Table 11-36 / 11-37). Total and fuzzable (§10.5): malformed input yields a typed TlvError, never a panic. Used by the get_card_inventory workflow (§5.12a), which calls it once per page (63 10 continuation) per P1 scope and maps each RegistryEntry into the typed model.