Low-Level Key Management
Low-Level Authentication & Crypto Hardware · Security Fundamentals track
6 min read
In this module
Keys at the Hardware Level
A cipher is only as strong as the key management around it. AES-256 means nothing if the key sits in a world-readable file. At the silicon level, key management comes down to three questions: where the keys physically live, how they're derived, and how you stop someone from peeling them out — even with the device in their hands.
Key Derivation in Firmware
Embedded devices and secure systems rarely sit on raw cryptographic keys. They derive keys on demand from a hardware secret combined with context-specific data, using a Key Derivation Function (KDF).
The hardware secret might be:
- A value burned into OTP fuses during manufacturing
- A PUF (Physically Unclonable Function) response
- A key stored in a TPM or secure element
Derivation mixes that secret with a context label (the key's purpose), a version number (so rotation is possible), and often a chunk of device-specific data:
// Simplified key derivation in firmwareuint8_t device_key[32];uint8_t derived_key[32];
// Read hardware-unique key from fuses or secure storageread_hardware_key(device_key);
// Derive a purpose-specific key using HKDFhkdf_sha256( derived_key, // Output: derived key device_key, 32, // Input key material (hardware secret) "firmware-encryption", // Context label (purpose) "v2", // Version (enables rotation) device_serial, 16 // Device-specific binding);A compromised derived key gives nothing to the attacker about the hardware secret or any sibling keys. As a bonus, you get arbitrarily many independent keys from one hardware secret without storing any of them separately.
Secure Storage Mechanisms
Where the bits physically sit decides how strong storage actually is:
OTP fuses: one-time programmable fuses permanently bake bits into silicon. Once programmed, they cannot be changed or erased. Root keys and secure-boot key hashes typically live here. Some SoCs read-protect fuse banks so software can't actually read them post-boot — the values are routed only to specific internal circuits.
Battery-backed SRAM: certain secure elements store keys in SRAM kept alive by a battery. Tamper the device — pop the case, anomalous voltage, you name it — and the battery disconnects. The SRAM loses its bits, the keys die with them. Standard fare in HSMs and payment terminals.
Secure flash partitions: many SoCs offer hardware-protected flash regions reachable only from code running in a specific security context (ARM TrustZone Secure World, for example). The flash controller enforces the access policy in hardware.
Production systems run a key tree. A root key (fuses or PUF) derives intermediate keys, which derive operational keys. The root never does data operations directly. Lose an operational key and the intermediate key derives a replacement. The root only comes out during manufacturing and key-ceremony events.
Here's one such tree, with illustrative labels. Each arrow is a KDF call like the hkdf_sha256 example above: parent key in, purpose label and version in, child key out. Notice that the operational keys at the bottom can be rotated by bumping a version string, without the root ever being touched.
Anti-Tampering Mechanisms
Hardware key management runs a parallel war against physical extraction:
Tamper-evident enclosures: the secure module is wrapped in a fine wire mesh. Cut the mesh to probe internal signals and you trip a tamper response that erases the keys. Standard in HSMs and payment terminals.
Active tamper response: temperature, voltage, and clock-frequency monitors watch for out-of-spec conditions that smell like fault injection. Anomaly detected, keys zeroised.
Glitch detectors: dedicated circuits watch the power supply and clock for the short disturbances attackers use to fault-inject. Catch a glitch, abort the current op, and — depending on policy — wipe the keys.
Light sensors: a decapsulated chip (its package removed to expose the die for probing) trips on-die light sensors, which kick off key destruction.
Physically Unclonable Functions (PUFs)
PUFs lean on the random imperfections in semiconductor manufacturing to mint a device-unique secret without ever putting it in non-volatile memory. Query the PUF and it regenerates the same response from the silicon's physical fingerprint.
SRAM PUFs read the power-up values of SRAM cells. Manufacturing variation gives each cell a slight bias toward powering up as 0 or 1. The resulting bit pattern is unique per chip and reproducible across power cycles, with the wobble cleaned up by error-correction codes.
Ring oscillator PUFs compare the frequencies of identically-designed ring oscillators. Manufacturing tolerances make each oscillator a fraction off the others, and the differences encode a device-unique bit string.
Arbiter PUFs race two signals along nominally identical paths and check which arrives first. Wire-delay variation decides, producing device-specific responses.
SRAM PUF operation:1. Power cycle the SRAM block2. Read the power-up values: 01101001 10110010 ...3. Apply error correction (fuzzy extraction)4. Feed the stable output into a KDF to derive a key5. The key exists only when needed, never stored permanentlyThe win with PUFs: the key doesn't exist in any memory while the device is off. An attacker who hoovers up every byte of non-volatile storage finds nothing. The silicon manufactures the secret afresh, from physics, every time you ask.
Key Management in Practice
Real systems pile layers on top of layers.
A smartphone might lean on ARM TrustZone to isolate key operations, stash the root key in OTP fuses, derive per-application keys via a KDF inside the Secure World, lift the most sensitive keys into the StrongBox keymaster (backed by a discrete secure element), and use a PUF for device attestation.
A server HSM might wrap key storage in tamper-responsive hardware, derive customer keys from a master key using a certified KDF, run all crypto inside the HSM boundary, and expose PKCS#11 or JCE interfaces so applications can use the keys without ever holding them.
The shared principle is defence in depth. No single mechanism stands alone. Hardware secrets, secure storage, key derivation, access control, and physical tamper protection each contribute to a system where extracting a key means defeating several independent barriers in succession.
Even the best hardware can't beat planning. Root-key compromise on a device with fused keys is unrecoverable; the device retires. That's why good designs build key hierarchies with revocable intermediate keys and back them with secure firmware updates that can rotate operational keys. The root key's only real day job is to verify those rotation updates.