LESSON 06

Secure boot, root of trust and key management

Building the integrity chain on constrained hardware, and keeping the signing keys alive for a decade.

11 min read video walkthrough

Why the chain starts in silicon

Annex I demands integrity protection for firmware and configuration. On an embedded device that means the code that runs first must be immutable and must verify what it loads. Anything less and an attacker with flash access owns the device permanently.

A workable chain on a typical MCU or SoC:

  1. Immutable boot ROM — mask ROM in silicon, or a first-stage bootloader written to a one-time-programmable region and locked.
  2. Root of trust public key — the verification key hash burned into eFuses/OTP. Never the private key.
  3. Second-stage bootloader — signature verified by stage 1 before execution.
  4. Application image — verified by stage 2, including version/anti-rollback counter.
  5. Runtime attestation (optional) — the device proves its measured boot state to a backend before receiving credentials.

Debug ports must be closed as part of this: JTAG/SWD disabled or authenticated in production, and the transition from development to production lifecycle state made irreversible.

Choosing where keys live

OptionStrengthCostTypical use
Plain internal flashWeak — readable via any code-execution bugFreeNever for long-lived secrets
MCU with protected flash region + readout protectionModerateFree with the right partLow-value devices, defence in depth
Integrated secure enclave (TrustZone-M, secure processor)GoodSilicon choiceMainstream connected products
Discrete secure element (SE05x, ATECC, TPM)Strong, tamper-resistant~€1 BOM plus board areaDevices holding third-party credentials, payment, critical class

The CRA does not name any of these. Your risk assessment justifies the choice — and that justification must be written down. A €12 sensor with a per-device symmetric key in protected flash can be perfectly defensible; the same sensor holding a fleet-wide shared key cannot.

Per-device secrets during manufacturing

Fleet-wide shared keys are the classic embedded failure: one device extracted compromises every unit, so a single flaw becomes a full-fleet recall. Provision unique per-device identity at production, ideally as a keypair generated inside the secure element so the private key never leaves it, with the manufacturing station holding only a signing CA and never the device secrets.

The production line then becomes part of your attack surface: HSM-backed CA, access-controlled programming stations, audit logs of every certificate issued. Market surveillance can ask how device identity is provisioned.

Signing infrastructure that survives ten years

  • HSM-held signing keys. No key material on a developer laptop or a CI runner's disk.
  • Separate keys per role — development, release candidate, production — so a compromised dev key does not sign shipped firmware.
  • A rehearsed rotation and revocation plan. Devices must be able to accept a new signing key via a signed update; design a key-update path or you cannot recover from a compromise.
  • Documented custody. Who can trigger a production signature, under what approval, with what audit trail.

The support period may be ten years or more. The keys, the HSM, the build container and the toolchain must all still exist and still work at year nine. Version and archive them together with the release.

Key takeaways

  • Anchor the integrity chain in immutable ROM plus a root-of-trust key hash in OTP; never store private keys in firmware.
  • Choose key storage on the basis of your documented risk assessment, not fashion.
  • Provision unique per-device identity in manufacturing; shared fleet keys turn one extraction into a full recall.
  • Signing keys live in an HSM, are separated by role, and need a rehearsed rotation path that survives a ten-year support period.

References

  • Annex I Part I (2)(c), (d), (f)
  • Annex I Part I (2)(j) (mitigating exploitation)

Check your understanding

  1. Q1Where should the root of trust private key live?

  2. Q2What is the main risk of a fleet-wide shared device key?

  3. Q3Anti-rollback protection exists to stop:

Sign in to track progress