Skip to main content

Module put_key

Module put_key 

Source
Expand description

PUT KEY (CLA 84, INS D8) — PDD §5.3.1, GPCS v2.3.1 §11.8.

P1 = KVN when replacing, 0x00 when adding (KVN inside data). P2 = 0x81 (multi-key bit + first KID 0x01). Data = new_kvn | key_block{ENC,MAC,DEK}, each block key_type | len | encrypted_key | kcv_len | kcv. Card echoes new_kvn | KCV_ENC | KCV_MAC | KCV_DEK.

Structs§

KeyBlock
One encrypted key block plus its KCV (built from backend output). The encrypted key already borrows (&[u8]) — no alloc here.

Functions§

put_key
Build the PUT KEY C-APDU plaintext for a 3-key set.