8 Key Management

Describes key types, slot numbering, the key registry, and PUF key wrapping.

Key Concepts

TermDefinition
Key registryIn-memory list (key_slots[]) that accumulates all keys loaded during a session. Maximum 10 entries.
VSS slotA numbered position (2-127) in the VSS where a key is stored on-device
Key codeA PUF-wrapped version of a key. Can only be unwrapped on the same physical device. Stored in slot `0x80 \
Signing keyThe first asymmetric key (slot 2) used by hsmsfmdgen.exe to sign the FWMD

Key Types Supported

TypeSubtypeGeneration MethodsStep
Asymmetric ECC P-256ecc_p256TPDS software, load from file, PUF hardware1, 1b
Symmetric AES-128aes128Load from file, manual hex entry1b
Symmetric AES-256aes256Load from file, manual hex entry1b

Key Slot Numbering Convention

 Slot range     Usage
 ----------     -----
   0 -   1      Reserved (not used)
   2            Secure Boot signing key (Step 1, fixed)
   3 - 255      Freely available for user keys and key codes
      
Note: In this use case demo, the convention keycode_slot = 0x80 | original_slot is used so that the LED demo application can locate key codes and verify them against the original keys. This is not a hardware or ROM Boot requirement -- in production, any slot from 3 to 255 can hold either a plain key or a key code, at the user's discretion.

Key Registry

Each entry in key_slots[] is a dictionary:

FieldTypeDescription
slotintVSS slot index (2-127)
typestr"asymmetric" or "symmetric"
subtypestr"ecc_p256", "aes128", or "aes256"
privatekeystrHex string (asymmetric private key)
publickeystrHex string (asymmetric public key X\
public_numbersobjec.EllipticCurvePublicNumbers (has .x, .y)
key_datastrHex string (symmetric key bytes)
keycodestrHex string of PUF-wrapped symmetric key (set by Step 1c)
keycode_prvstrHex string of PUF-wrapped private key (set by Step 1c)
labelstrHuman-readable description

PUF Key Wrapping

The PUF produces a device-unique wrapping that binds keys to a specific chip. A wrapped key (key code) can only be unwrapped on the device that created it.

Why this matters: When key codes are used (Step 1c), the original key material does not need to be stored anywhere. The VSS only contains the opaque key codes, and the application firmware recovers the original keys at runtime by calling the PUF unwrap function. This means:

  • No plaintext keys on-device: an attacker reading the Flash sees only key codes, which are cryptographically bound to that specific chip's PUF and cannot be used on another device

  • No plaintext keys off-device: after provisioning, the original key material can be discarded. The device is self-sufficient -- it reconstructs the keys from the key codes using its own PUF.

  • Clone-resistant: copying the Flash contents to another chip is useless because the PUF response differs per silicon die

Note: For any deployment beyond development/debugging, always execute Step 1c and select only "Key codes" in the Step 3 VSS content dialog. This ensures the strongest level of key protection.

Key code size formula (from HSM firmware DRV_PUF_KEY_CODE_SIZE):

keyCodeSize = 36 + keyLen + 16 * ceil(keyLenBits / 384)
      
Key TypeKey LengthKey Code Size
ECC P-256 private (32 B)3284 bytes
AES-128 (16 B)1668 bytes
AES-256 (32 B)3284 bytes
ECC P-256 public (64 B)64132 bytes
Wrapping flow: