HSM / PKCS#11 / Firmware Signing

What you will do: Upload a firmware binary or use the sample UEFI manifest. Generate classical and PQC key pairs, sign the manifest and verify both signatures. Change the received manifest to test rejection.

Worked example: With the defaults — ML-DSA-65 against RSA-2048 with SHA-256 — both signatures come back VERIFIED and the Migration Comparison table shows the signature growing from 256 B to 3,309 B (12.9×).

Runtime and privacy: The cryptographic exercise runs in this browser. Review the site privacy terms before entering sensitive material; use synthetic inputs for learning and evaluation.

Browse all Crypto Lab tools · Learn with Secure Boot & Firmware PQC

For your role

Developer / Engineer
Select ML-DSA-65 beside RSA-2048 in Upload & Configure, use the mock UEFI manifest or your own binary, and walk the four steps: the CMS output shows the pure-mode signing the RFC 9882 comment in the configuration refers to.
Security Architect
The side-by-side keys, signatures and CMS output show the size a firmware image grows by under ML-DSA-65, which is the number your boot ROM and update channel must have room for.
Researcher / Academic
Run the Secure Boot PQC Known Answer Tests panel, then compare the classical and post-quantum CMS structures produced from the same manifest.
Certification & Validation Engineer
Run the Secure Boot PQC Known Answer Tests panel, then sign the mock UEFI manifest with ML-DSA-65 beside RSA-2048 in Upload & Configure: the panel is algorithm evidence, while the CMS output is what the device's verifier will actually have to accept.
IT Ops / DevOps
Sign the mock UEFI manifest with both algorithms and keep the two CMS outputs: they are what a signing service and a verifier on the device exchange, and the difference between them is your update-pipeline change.

Firmware Signing Migrator

Sign firmware with both a classical algorithm and a post-quantum algorithm side-by-side. Compare keys, signatures, and CMS output. All PKCS#11 operations execute in SoftHSM3 WASM.

Initializing SoftHSM…

C_Initialize → C_InitToken → C_OpenSession → C_Login

STEP 1 OF 4

Upload & Configure

Select algorithms, upload a firmware binary (or use the mock UEFI manifest), and review the pure-mode signing configuration.

// Pure mode per RFC 9882 §3.1 / RFC 9814 §1
// No caller pre-hashing — algorithm handles internally

Why firmware signing matters

  • UEFI Secure Boot verifies every firmware image against signed db certificates at boot
  • TPM PCR measurements attest firmware integrity — signatures must survive quantum attacks
  • Supply chain compromise via forged signatures is a critical threat — PQC eliminates Shor's algorithm risk
Signing mode: Pure  [Standard per RFC 9882 §3.1 & RFC 9814 §1]

ML-DSA uses SHAKE-256 and SHAKE-128 internally (FIPS 204 §3.7); SLH-DSA-SHA2-128S uses SHA-256 internally (the "SHA2" in the name; SHA-512 appears only in the 192- and 256-bit SHA2 sets, FIPS 205 §11.2.2). Both are called in pure mode: the signer is handed the message directly, with no separate pre-hash step. HashML-DSA (pre-hash) is not specified for CMS (RFC 9882 §3.1) and must not be used in X.509 certificates (RFC 9881 §8.3). Your hash selection applies to: firmware digest display + classical signature mechanism (e.g. CKM_SHA256_RSA_PKCS).

Why HashML-DSA is not used in CMS (RFC 9882 §3.1)

“… in most situations, CMS signatures are computed over a set of signed attributes that contain a hash of the content, rather than being computed over the message content itself. Since signed attributes are typically small, use of pre-hash modes in the CMS wouldn't significantly reduce the size of the data to be signed, and hence offers no benefit.”
  • What ML-DSA is given (RFC 9882 §3.2): with signedAttrs, the complete DER encoding of the signed attributes, which must include a content-type attribute and a message-digest attribute (the hash of the content). Without signedAttrs, the content itself. Signed attributes are the preferred form, and an HSM then receives only that small attribute set (§5).
  • This demo builds SignedData without signedAttrs and signs the short manifest text directly, so it shows the pure-mode signing call but not the signed-attributes step. With no signed attributes the SignerInfo digestAlgorithm carries no weight, and the PQC envelope names the value the RFCs prescribe: SHA-512 for ML-DSA (RFC 9882 §3.3, MUST) and the tree hash, SHA-256, for SLH-DSA-SHA2-128S (RFC 9814 §4, SHOULD), whatever hash you picked for the classical signature.
  • X.509 is a separate rule. RFC 9881 §8.3 bars HashML-DSA from certificates mainly for interoperability: a verifier would have to be told whether to run ML-DSA.Verify or HashML-DSA.Verify.

Drop firmware binary here

or click to browse — any file format

▸ Using mock UEFI firmware manifest (no file uploaded)
Firmware: APTIO_V_GenericServerPlatform
Version: 5.27.1234
Vendor: AMI
Platform: Xeon Scalable 4th Gen Reference Platform
Current signing: RSA-2048 (quantum-vulnerable)
ComponentSizeHash
PEI Core512 KBa3f2c1d4e5b6a7f8...
DXE Core1.2 MBb4c3d2e1f0a9b8c7...
UEFI Shell256 KBc5d4e3f2a1b0c9d8...
Setup UI384 KBd6e5f4a3b2c1d0e9...
Network Stack192 KBe7f6a5b4c3d2e1f0...
ML-DSA-65:
RSA-2048:
SHA-256:

Choosing an algorithm

  • ML-DSA-44 — NIST Level 2 · smallest ML-DSA keys/sigs · non-critical firmware where size matters
  • ML-DSA-65 — NIST Level 3 · balanced · recommended general-purpose firmware signing
  • ML-DSA-87 — NIST Level 5 · required by CNSA 2.0 for NSS; approved for firmware signing alongside the preferred single-tree LMS/XMSS (SP 800-208; multi-tree HSS and XMSS^MT are not allowed for NSS)
  • SLH-DSA-SHA2-128S — NIST Level 1 · smallest pubkey (32 B) but very large signature (7,856 B) · This module's advice: use it only for root-of-trust and infrequent signing (e.g. UEFI PK/KEK), not per-image signing. Not part of CNSA and not approved for any use in NSS (NSA CNSA 2.0 FAQ v2.2, p. 11)

Note: Hash applies to classical signing mechanism (CKM_SHA256_RSA_PKCS) and digest display. PQC algorithms (ML-DSA-65) use SHAKE-256 and SHAKE-128 internally — pure mode per RFC 9882/9814.

TERMINAL OUTPUT
Click Execute to run this step.

Educational sandbox note: Simulation mode active. Algorithm selection, comparison table, and CMS structure are always shown. Browser WASM is an educational sandbox, not a FIPS 140-3 / CMVP-validated production HSM. Passing this exercise does not verify a deployed UEFI firmware verifier or production signing pipeline — validate HSM firmware, certificate chains, and target boot-verifier acceptance in your own hardware environment.

KAT note: These checks do not follow the algorithm selected above; they run fixed parameter sets. Rows tagged “NIST ACVP sample” compare the engine with an answer NIST published: ML-DSA-87 verification of a NIST reference signature; for both ML-DSA-87 and ML-DSA-65 (the default above) one NIST sigVer case that must verify and one that must be rejected (FIPS 204); verification of a NIST-generated SLH-DSA-SHA2-128s signature (FIPS 205); and SHA-256 and SHA-512 digests (FIPS 180-4). The other ML-DSA and SLH-DSA parameter sets are covered on the SLH-DSA page and in the Validation Workbench. The row tagged “Functional” (sign + verify round trip) generates a fresh key and only checks that the engine accepts its own signature, so it has no NIST expected value.

Secure Boot PQC Known Answer Tests

UEFI 2.11 · TPM 2.0 · FIPS 204 · FIPS 205 · FIPS 180-4

Predict a one-byte change

This fictional sample generates fresh ML-DSA-87 keys. Predict whether changing the selected byte should preserve verification or key confirmation, then run the actual operation.

Click Run known-answer checks to run 9 use-case scenarios. Evidence in this set: NIST ACVP-Server reference sample — Expected values copied from the public NIST ACVP-Server repository with immutable source identity; Functional round-trip — Output produced by an implementation is consumed by the same or paired implementation.

Reference samples from the public NIST ACVP-Server repository · UEFI 2.11 · TPM 2.0 · FIPS 204 · FIPS 205 · FIPS 180-4 · Generated keys are for educational use only.

Production Tool Capabilities & Verification Requirements

What this sample check establishes: Exercises post-quantum firmware image hashing, signature generation (`ML-DSA`, `SLH-DSA`, `LMS/HSS`), and tamper-detection verification.

Browser sandbox limitation (non-certification boundary): Executes in browser WASM memory; it does not verify Boot ROM mask code, OTP fuse burning, or physical glitch/fault-injection resilience.

What to require and test in your production tools:

  • Hardware Root of Trust (Boot ROM / MCU secure enclave) supporting SP 800-208 `LMS/HSS`, `XMSS`, or FIPS 204 `ML-DSA-87` signature verification.
  • Monotonic anti-rollback security version number (SVN) counters stored in hardware fuses or RPMB/TPM.
  • HSM signing appliance (FIPS 140 Level 3+, SP 800-208 §8) that stores the incremented leaf index in non-volatile memory before exporting any signature.

Try it

  1. 1. Predict before you run it.
  2. 2. Run or change the tool above.
  3. 3. Explain what the result shows.

The signing configuration says "pure mode, no caller pre-hash". In a CMS SignedData that uses signed attributes, what does RFC 9882 say the ML-DSA signer is given?

Next step

Turn it into a plan: Infrastructure Modernization Planner

This tool practises the Secure Boot & Firmware PQC module, phase 6 (Infrastructure & Performance); Infrastructure Modernization Planner produces a deliverable of that phase.