HSM / PKCS#11 / Stateful Hash Signatures
What you will do: Choose an SP 800-208 LMS/HSS parameter set (hash, height, W, levels), Sign Message to advance the one-time key counter, Simulate State Loss, then verify a Rust-signed signature with the C++ engine.
Worked example: With the default LMS_SHA256_M32_H5 / LMOTS_W8 key each Sign Message moves the Signature Counter toward 32; at 32 the panel shows KEY EXHAUSTED, and Simulate State Loss names the leaf indexes that would be reused.
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 Stateful Hash Signatures
For your role
- Developer / Engineer
- Use the HSS / LMS Explorer to pick the hash (SHA-256 or SHAKE-256), tree height and Winternitz parameter, sign with Sign Message, and watch the Signature Counter: the token returns CKR_KEY_EXHAUSTED when the state runs out, which is the error your code has to handle.
- Security Architect
- Press Simulate State Loss after a few signatures: the What happens if state is lost panel shows why a stateful key can never be restored from backup, which decides where these keys may live in your design.
- Researcher / Academic
- Sign with the Rust engine and press Verify Signature (C++ engine), then tick Tamper with message or Tamper with signature: the cross-engine verification shows the exact byte flip that breaks C_Verify.
- Certification & Validation Engineer
- Sign until the Signature Counter runs out and the token returns CKR_KEY_EXHAUSTED, then press Simulate State Loss: state handling is what a module that signs with LMS has to get right, and a stateful key can never be restored from backup.
Initializing SoftHSM…
C_Initialize → C_InitToken → C_OpenSession → C_Login
Stateful Hash Signatures
Strictly operating under PKCS#11 v3.2: CKM_HSS and CKM_XMSS.
Scroll sideways to see all sections →
Strict PKCS#11 v3.2 Compliance
Under PKCS#11 v3.2, LMS does not have a standalone capability. It is mapped as an HSS tree with exactly 1 level (L=1).
State Exhaustion Handling
State exhaustion is managed by the WASM boundary natively returning CKR_KEY_EXHAUSTED when the Final Node is consumed. Note: this browser WASM engine is an educational sandbox with volatile memory, not a CMVP-validated production HSM with non-volatile monotonic state storage (SP 800-208 §6.2).
State Management Simulator
Select an SP 800-208 parameter set, then sign messages to watch the one-time key counter advance. See what happens at exhaustion, and how the HSM answers an attempt to roll the state back.
Signature Counter
0 / 32Simulate State Loss asks the HSM to take this key back to an earlier signature, as a backup restore or a cloned key would, and shows how it answers.
Signature Log
No signatures yet. Click "Sign Message" to begin.
Active Key Info
How does an engineer check that a leaf cannot be reused?
A leaf represents a one-time signing key. After using leaf 42, the signer must remember not to use it again—even after a crash. Skipping a leaf wastes capacity; reusing it breaks the single-use rule.
NIST requirement: SP 800-208 §8.1 requires incrementing and durably storing the leaf index before exporting a signature or accepting another signing request. It prohibits generating more than one signature with the same one-time key. This is the NIST profile, not a universal CC/EUCC test procedure.
Practical assessment methods—not a prescribed NIST test checklist:
- Design and code review: trace the counter update, persistent write and signature output. Check saving failures; a cached write may not survive power loss.
- Crash and power-loss tests: interrupt around the state update, restart and sign again. Check that consumed leaves cannot be reused.
- Concurrent requests: check that two requests cannot reserve the same leaf.
- Recovery and rollback: examine whether restore, failover or cloning can make consumed leaves available again.
Reading results: associate signature leaf indices with the signing key and, for multi-tree schemes, the relevant tree. Two different messages signed with the same one-time key demonstrate failure even if both signatures verify. Repeated appearance of a stored parent-tree signature is not by itself evidence of generating it again.
No reuse observed in finite tests does not prove reuse impossible. Combine results with design and implementation evidence. An algorithm-test pass alone does not establish crash-safe state management.
Hub limit: this exercise does not perform hardware power-loss testing or prove validated hardware, persistent-storage guarantees or rollback resistance—even when live signing succeeds.
NIST SP 800-208 (October 2020), §§8.1 and 9.1Cross-Engine Verification — Rust Signs · C++ Verifies
No keys yet — generate a key pair in the HSS / LMS Explorer above first.
Verify is waiting: select a key pair in step 1.
No keys yet — click Execute to run the provisioning flow.
No keys yet — click Execute to run the provisioning flow.
Production Tool Capabilities & Verification Requirements
What this sample check establishes: Demonstrates NIST SP 800-208 / RFC 8554 Leighton-Micali (LMS / HSS) Merkle-tree key generation, one-time leaf index advancement, and signature verification.
Browser sandbox limitation (non-certification boundary): Browser state resets on reload; in production, reusing a single LMS leaf index due to VM rollback or NVRAM failure allows signature forgery and breaks the key's security.
What to require and test in your production tools:
- A FIPS 140 Level 3+ hardware module that stores the incremented LMS/HSS leaf index in non-volatile memory before releasing any signature (SP 800-208 §8); a monotonic counter is a useful aid, not a requirement.
- No export, backup or cloning of LMS/HSS/XMSS private keying material (SP 800-208 §8); use multi-tree HSS/XMSS^MT with sub-trees on separate modules for redundancy.
- Automated exhaustion alerting when remaining LMS leaf capacity drops below operational thresholds.
Try it
- 1. Predict before you run it.
- 2. Run or change the tool above.
- 3. Explain what the result shows.
A signing device used leaf 12 after its backup was taken. Why is restoring that old signing state unsafe?
A sample LMS key has one unused leaf. The token gets two signing requests at the same time. What evidence would allow the maintainer to accept the test?
Next step
Keep learning: SLH-DSA: Stateless Hash SignaturesSLH-DSA: Stateless Hash Signatures follows Stateful Hash Signatures, the module this tool practises, in the Software Infrastructure track.
Related content
Next in HSM / PKCS#11