Dual Private Keys and HSM Interoperability: ML-DSA Seeds vs Expanded Keys
An ML-DSA private key can exist in two forms: a 32-byte seed, or a much larger expanded private key derived from it. Both are legitimate under the standards. But which form a hardware security module (HSM) generates, stores, backs up and exports decides whether you can move a key between products, recover it after a disaster or re-home a certification authority (CA) later. This page sets out what FIPS 204 and RFC 9881 actually say about the two forms, corrects an error in the earlier version of this page, and explains the questions to settle with any HSM vendor before you generate long-lived post-quantum CA keys.
What are the two forms of an ML-DSA private key?
FIPS 204, the Module-Lattice-Based Digital Signature Standard (PDF), defines key generation in two steps. A random 32-byte seed, written ξ, is generated first, and the internal key-generation function expands it into the full private key and the public key. FIPS 204 notes that “to reduce the space needed for the private key, one can store only the 32-byte seed ξ, which is sufficient to generate the other parts of the private key.” It also says that, because the seed can be used to compute the private key, “it is sensitive data and shall be treated with the same safeguards as a private key.”
The expanded private key is much larger. FIPS 204 Table 2 gives these sizes in bytes:
| Parameter set | Private key (expanded) | Public key | Signature |
|---|---|---|---|
| ML-DSA-44 | 2,560 | 1,312 | 2,420 |
| ML-DSA-65 | 4,032 | 1,952 | 3,309 |
| ML-DSA-87 | 4,896 | 2,592 | 4,627 |
Source: FIPS 204, Table 2 (August 2024). The seed is 32 bytes for every parameter set.
What did the earlier version of this page get wrong?
The earlier version gave the ML-DSA-44 expanded private key as 2,528 bytes. FIPS 204 Table 2 gives 2,560 bytes, and RFC 9881 encodes the ML-DSA-44 expanded key as an OCTET STRING of exactly 2,560 bytes. The earlier page also described seeds as “32–64 bytes” for ML-DSA; FIPS 204 specifies a 32-byte seed. Both figures are corrected above. The earlier page also contained a 17-vendor comparison table and effort estimates that we could not verify against current vendor documentation, so we have removed it (see below).
How does RFC 9881 encode ML-DSA private keys?
RFC 9881 (IETF Standards Track, October 2025) specifies how ML-DSA is used in X.509 certificates and CRLs, including the private key format. It defines a CHOICE with three representations:
- seed: just the 32-byte seed, from which both the expanded private key and the public key can be derived;
- expandedKey: the expanded private key derived from the seed (2,560, 4,032 or 4,896 bytes);
- both: the seed and the expanded key together, which RFC 9881 says allows interoperability because “some may want to use and retain the seed and others may only support expanded private keys.”
RFC 9881 says the seed format is RECOMMENDED for storing and transmitting ML-DSA private keys, and that “generating the seed in one cryptographic module and then importing or exporting it into another cryptographic module is allowed.” It also tells implementations to identify the format from the ASN.1 tag “rather than any other heuristic like length”.
Why can’t you get the seed back from the expanded key?
This is the point that matters most for HSM planning. RFC 9881 states that expanding a private key from a seed “is a one-way function, meaning that once a full key is expanded from seed and the seed discarded, the seed cannot be recreated, even if the full expanded private key is available.” For that reason it is RECOMMENDED that “implementations retain and export the seed, even when also exporting the expanded private key.”
Our analysis: if a key is generated in a module that keeps only the expanded form, every later system that handles that key must also accept the expanded form. If your target platform, or a future replacement HSM, accepts only seeds, a key held only in expanded form cannot be moved to it. That choice is made at the moment of key generation, and for a root or issuing CA key it is effectively permanent.
What happens when a key arrives in both formats?
RFC 9881 says that when a recipient receives a private key containing both the seed and the expanded key, it SHOULD perform a seed consistency check: regenerate the expanded key from the seed and confirm it is bytewise equal to the value presented. If the check is done and the two do not match, the recipient “MUST reject the private key as malformed.” For HSM-to-HSM migration, backup restore and key ceremony evidence, it is worth knowing whether your products perform this check.
Does the same issue apply to ML-KEM?
Yes, in a similar way. FIPS 203 (PDF) says the seed (d, z) generated during ML-KEM key generation “can be stored for later expansion”, and that because it can be used to compute the decapsulation key “it is sensitive data and shall be treated with the same safeguards as a decapsulation key.” FIPS 203 Table 3 gives decapsulation key sizes of 1,632 bytes (ML-KEM-512), 2,400 bytes (ML-KEM-768) and 3,168 bytes (ML-KEM-1024). ML-KEM keys are usually shorter-lived than CA signing keys, so the long-term portability question is most acute for ML-DSA.
What about pre-hashing and large payloads in an HSM?
HSM signing often separates hashing (done by the application) from the private-key operation (done in the module). RFC 9881 says the HashML-DSA mode in FIPS 204 “MUST NOT be used” in X.509 certificates for CRLs, OCSP, certificate issuance and related PKIX protocols, primarily for interoperability. Instead it describes ML-DSA’s External μ pre-hashing mode (Appendix D), which externalises the message pre-hash while keeping pure ML-DSA signatures. If your CA or signing service relies on the client hashing before the HSM signs, confirm how the product implements this for ML-DSA.
What should you confirm with an HSM vendor?
The standards allow seed, expanded and both formats, so behaviour differs by product, model and firmware. Before generating long-lived ML-DSA keys, get written answers to questions such as:
- Does the module keep the seed after key generation, and can it export it under wrap?
- Which RFC 9881 formats can it import and export: seed, expandedKey or both?
- Does its backup and restore process preserve the seed?
- Does it perform the RFC 9881 consistency check on import?
- Is the ML-DSA implementation inside the validated boundary, as shown on the module’s NIST CMVP certificate?
These are starting questions, not a full assessment. The answers have to be checked against the vendor’s current documentation and the CMVP listing for the exact firmware you will run. Our vendor-neutral HSM analysis and “quantum-ready” HSM guide explain why a firmware announcement alone does not settle these points.
Where are SafeCipher’s HSM vendor ratings?
An earlier version of this page had a 17-product table. Most of its columns described how each product handles ML-DSA seeds and expanded keys, and the configuration steps involved. Those are technical statements about each product, and we could not verify them against the vendors’ current documentation, so we have not republished them. SafeCipher’s own ratings of the same 17 products and services are on our vendor-neutral HSM analysis. They are labelled as professional judgement and link to each vendor’s documentation. Where a vendor documents key formats, check them directly. For example, Fortanix’s DSM algorithm support page (updated 24 November 2026) lists ML-DSA keys as “PKCS#8 DER/ SubjectPublicKeyInfo DER (RFC9881)”.
How does this fit a post-quantum PKI migration?
Key format is one of several decisions that are hard to reverse once a post-quantum CA key exists. The NCSC’s migration timelines say that migrating an enterprise PKI “will require both the creation of a new PQC root-of-trust, and issuing new PQC certificates to all entities on the network.” The HSM that holds that new root’s key, and the format its key is stored in, will outlive many of the systems around it. For the wider decisions, see:
- Replace AD CS or add a post-quantum hierarchy?
- Hybrid vs composite vs parallel PKI
- Trust now, forge later: the CA key risk
- The post-quantum cryptography hub for every SafeCipher PQC guide
Can your architecture actually support post-quantum migration?
SafeCipher’s PQC Architecture Readiness Assessment independently determines whether your existing cryptographic architecture can carry post-quantum migration before you commit budget to algorithms or products. That covers your PKI, HSMs, certificate authorities, key custody, trust relationships and governance. Architecture before algorithms.
Go deeper: read POST-QUANTUM PKI by Stephen Monti, on planning and building post-quantum certificate hierarchies.
