Skip to content

design: add proposal for post-quantum ML-DSA (FIPS 204) private keys - #9436

Merged
cert-manager-prow[bot] merged 7 commits into
cert-manager:masterfrom
FelixPhipps:design/mldsa-private-keys
Oct 12, 2026
Merged

cert-manager-prow[bot] merged 7 commits into
cert-manager:masterfrom
FelixPhipps:design/mldsa-private-keys

Conversation

@FelixPhipps

@FelixPhipps FelixPhipps commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Adds a design for supporting ML-DSA private keys in cert-manager, using the Go 1.27 standard library (crypto/mldsa and the ML-DSA support in crypto/x509).

The proposal covers:

  • API: privateKey.algorithm "MLDSA" with size 44/65/87 (default 44). There are no new signature algorithm values: signatureAlgorithm must be unset for ML-DSA keys, because each key allows only one signature algorithm
  • An MLDSAPrivateKeys feature gate for the controller and webhook: alpha in v1.22, with beta in v1.23 and GA in v1.24 as targets
  • Moving the go directive to 1.27 in all go.mod files (Bump the go directive to 1.27 #9440)
  • SelfSigned, CA and Kubernetes CSR signer support; other issuers receive the CSR unchanged and never fall back to a classical key
  • Lifecycle, keystore, size limit, upgrade/downgrade and test plans
  • Prototype measurements and answers to the questions raised in Post-Quantum Cryptography: Plan ML-DSA certificate support for Go 1.27 #8929

Builds on #8527, which already uses the standard library, and lists what it needs before it can merge.

Ref: #8929

Added a design for supporting ML-DSA private keys in cert-manager

Add a design for supporting ML-DSA private keys and signatures in
cert-manager, using the Go 1.27 standard library (crypto/mldsa and the
ML-DSA support in crypto/x509).

The proposal covers:

- API: privateKey.algorithm "MLDSA" with size 44/65/87 (default 44),
  and MLDSA44/MLDSA65/MLDSA87 signature algorithms
- An alpha MLDSAPrivateKeys feature gate for the controller and webhook
- Keeping the go.mod directive at 1.26 and placing ML-DSA code behind
  a go1.27 build tag, so library consumers can stay on Go 1.26
- SelfSigned, CA and Kubernetes CSR signer support; other issuers
  receive the CSR unchanged and never fall back to a classical key
- Lifecycle, keystore, size limit, upgrade/downgrade and test plans
- Prototype measurements and answers to the questions raised in cert-manager#8929

Supersedes the approach taken in cert-manager#8527 (cloudflare/circl and
hand-built ASN.1) in favour of the standard library.

Ref: cert-manager#8929

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
@cert-manager-prow cert-manager-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. kind/design Categorizes issue or PR as related to design. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Oct 7, 2026
@SgtCoDFish

Copy link
Copy Markdown
Member

Supersedes the approach taken in #8527 (cloudflare/circl and hand-built ASN.1) in favour of the standard library.

I don't think that reflects the state of #8527 today - it looks like that one uses the stdlib as expected although the PR description still references CIRCL. I think we could probably drive #8527 to completion (albeit from a quick glance it does seem to need a bit more work - tests being the main thing missing.

It also uses constants for the different ML-DSA "sizes", while it might well make sense for us to use the Size field. It also misses ML-DSA 44

Keeping the go.mod directive at 1.26 and placing ML-DSA code behind a go1.27 build tag, so library consumers can stay on Go 1.26

This feels like a very AI-invented requirement 😛 We should absolutely feel free to bump to go1.27 in go.mod. We avoid breaking library consumers if we can, but they're secondary to cert-manager itself and that doesn't really extend to the go.mod directive anyway.

API: privateKey.algorithm "MLDSA" with size 44/65/87 (default 44), and MLDSA44/MLDSA65/MLDSA87 signature algorithms

44 as a default seems sane as it's smallest and it appears to offer 128-bits of security which should be OK. If we have to change the default, no big deal.

Address review feedback on cert-manager#9436:

- Move the go directive to 1.27 in every go.mod instead of using a
  go1.27 build tag; drop the stub, internal/mldsa and min-Go CI jobs
- Build on cert-manager#8527, which now uses the standard library, and list what it
  still needs (MLDSA with size, ML-DSA-87, restored checks.go mismatch
  checks, feature gate, webhook validation, tests)
- Note maintainer agreement on the default parameter set (44) and
  openness to using the size field
- Describe the preparatory PR (go.mod bump plus safety checks) and the
  GODEBUG and lint impact of Go 1.27

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
@FelixPhipps

Copy link
Copy Markdown
Member Author

Thanks @SgtCoDFish, that's really helpful. I've updated the design accordingly:

Separately, bumping to Go 1.27 makes crypto/x509 accept ML-DSA CSRs, so without extra checks an RSA/ECDSA CA issuer would sign them with no gate involved. I'd like to send a small PR with the go.mod bump plus those safety checks (and a fix for a PrivateKeyMatchesSpec panic on unknown algorithms, which I think is worth backporting). Does that sound OK?

@SgtCoDFish

Copy link
Copy Markdown
Member

I'd like to send a small PR with the go.mod bump plus those safety checks (and a fix for a PrivateKeyMatchesSpec panic on unknown algorithms, which I think is worth backporting). Does that sound OK?

Sounds like a good start, happy to review. Without knowing the details of the panic, the backporting seems a little suspect - my gut is that it won't be a problem worth backporting for unless we can show that a cert-manager user can trigger a panic in the controller by creating a CertificateRequest with an unsupported key type or something.

Backporting would be awkward because the older supported cert-manager releases aren't on Go 1.27 and we wouldn't normally upgrade the Go minor version in a backport unless we had to.

Felix Phipps and others added 2 commits October 8, 2026 12:13
Users can't trigger the panic directly, because the CRD enum and the
webhook reject unknown algorithms, and older releases are built with
Go 1.26. Describe the fix as defensive, and don't backport it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
ML-DSA handling in crypto/x509 depends on the toolchain, which is
already Go 1.27, not on the go directive. Bumping go.mod therefore
doesn't need its own safety checks. The gate checks come with the
ML-DSA implementation and must land before v1.22 is cut, with a small
fallback change only if the ML-DSA work misses the release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
@FelixPhipps

Copy link
Copy Markdown
Member Author

Thanks @SgtCoDFish. I've opened #9440, which is just the go directive bump to 1.27. On reflection, the safety checks don't belong there: whether crypto/x509 accepts ML-DSA depends on the toolchain, which is already Go 1.27, not on the go directive. The gate checks will come with the ML-DSA implementation instead. I've updated the design to say they need to land before v1.22 is cut, with a small fallback check only if ML-DSA misses the release.

Agreed on the backport, and you're right that a user can't trigger the panic: the CRD enum and the webhook both reject unknown algorithms, so it would only happen after a downgrade. I've dropped the backport from the design, and the fix will go in with the ML-DSA work as a defensive change.

cert-manager-prow Bot pushed a commit that referenced this pull request Oct 8, 2026
cert-manager is already built with Go 1.27.1. Moving the go directive
to 1.27.0 in every go.mod lets code use APIs that are new in Go 1.27,
such as crypto/mldsa, which the ML-DSA private keys design (#9436)
needs.

GODEBUG defaults follow the go directive. Between Go 1.26 and 1.27 only
tracebacklabels and x509sslcertoverrideplatform change; the latter only
affects macOS and Windows.

Go 1.27 also enables golangci-lint's modernize/embedlit check, which
reports hundreds of struct literals that could omit embedded field
types. Disable it for now so that the fixes can go in a separate
mechanical PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

@SgtCoDFish SgtCoDFish left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a few bits on this, but the sig alg stuff is probably the most discussable thing. I reckon adding Ed25519 to signature algs was likely a mistake, and it could be one this design will repeat!

Comment thread design/20261007.mldsa-private-keys.md Outdated
MLDSA44 SignatureAlgorithm = "MLDSA44"
MLDSA65 SignatureAlgorithm = "MLDSA65"
MLDSA87 SignatureAlgorithm = "MLDSA87"
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: These sig alg values are maybe not helpful? For RSA and ECDSA keys there's a meaningful difference between different SignatureAlgorithms (the user is deciding which size of SHA function to use for at least signing the CSR).

For Ed25519 and ML-DSA, there is only one value that's correct for a given key. If I've requested an ML-DSA-44 key, then the signature on my CSR must be ML-DSA-44 and can be no other value.

The signature on the resulting cert is also deterministic based on the signer, not the key we're creating here. If I generate a CSR using an ML-DSA-44 key but the signer is using a ML-DSA-87 key then the signature on the cert I get at the end will be ML-DSA-87 and nothing I configure in my CertificateSpec will affect that.

As such, I think the existence of SignatureAlgorithm for Ed25519 and ML-DSA seems entirely pointless. We could:

  1. just omit these values, because they're not helpful to end users
  2. add them to match the x509 package, but then we're just adding a footgun.
  3. add a "MLDSA" catch-all value, but it's still equally useless

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, went with option 1 in 2cb260a. There are no ML-DSA signature algorithm values, and signatureAlgorithm must be unset when algorithm: MLDSA. That needs an explicit webhook check, because a key algorithm with no entry in keyAlgToAllowedSigAlgs currently accepts any signature algorithm. The other two options are listed under Alternatives 4. I left PureEd25519 alone since it's an existing value.

Comment thread design/20261007.mldsa-private-keys.md Outdated
Comment on lines +311 to +319
**Beta**, default on:
- At least one release cycle as alpha with no ML-DSA-specific bugs open.
- User feedback from at least 2 adopters running ML-DSA in production or staging.
- The compatibility matrix covers the major ingress, mesh and proxy implementations.
- The OpenSSL key format question has been reviewed again, based on what Go supports at the time.

**GA**:
- Two releases at beta with no significant issues.
- The FIPS status has been reviewed again (whether Go FIPS 140-3 module v1.26.0 has been certified).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: if these requirements are taken from somewhere I think we should change the source! They're very conservative, and I don't see a reason why we couldn't ship this as beta in v1.23 and GA in v1.24 if we end up happy with it.

We shouldn't commit to that timeline here - but we also don't need to add artificial waiting periods here. "We're happy with ML-DSA in cert-manager" is a fine enough signal.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've removed the waiting periods. The doc now aims for beta in v1.23 and GA in v1.24, says these are targets rather than commitments, and uses "maintainers are happy with ML-DSA in cert-manager" as the signal to move on.

Comment thread design/20261007.mldsa-private-keys.md Outdated
- **Not every consumer can use ML-DSA yet.** cert-manager can write a perfectly valid ML-DSA `kubernetes.io/tls` Secret that an ingress controller, proxy, JVM or load balancer can't load. This is the main operational risk. We handle it through documentation (a parallel canary flow and a compatibility matrix, tracked in a follow-up issue) rather than code.
- **A mixed chain doesn't give post-quantum authentication.** An ML-DSA leaf signed by an ECDSA CA can still be forged by anyone able to break the CA's ECDSA key. cert-manager will allow it, because it's useful for staged migration, but the docs will say clearly that the whole chain must be ML-DSA.
- **Key format interoperability.** RFC 9881 allows three PKCS#8 private key formats: `seed`, `expandedKey` and `both`. Go writes and reads **seed-only** keys. OpenSSL 3.5+ writes `both` **by default**, and Go rejects that format with a clear error. This matters for users who bring their own CA key to a CA issuer. See [Key generation, encoding and parsing](#key-generation-encoding-and-parsing).
- **FIPS builds.** `crypto/mldsa` is unavailable when built against the Go FIPS 140-3 module v1.0.0, and available from module v1.26.0. Any FIPS-mode distribution of cert-manager needs to select v1.26.0 or later. As of Go 1.27.1, v1.26.0 is listed as "in process" rather than certified, so a FIPS-validated ML-DSA build isn't possible yet. Upstream cert-manager doesn't publish FIPS builds, so this only affects downstream distributions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I'd remove this, FIPS is irrelevant to open source cert-manager currently. This is a problem for the downstream vendors.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, along with the other FIPS 140 mentions elsewhere in the doc. The only remaining references are FIPS 204/205, which are just the names of the standards.

Comment thread design/20261007.mldsa-private-keys.md Outdated

**GA**:
- Two releases at beta with no significant issues.
- The FIPS status has been reviewed again (whether Go FIPS 140-3 module v1.26.0 has been certified).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: As above, I'd remove the FIPS stuff. No need for it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, along with the other FIPS 140 mentions elsewhere in the doc. The only remaining references are FIPS 204/205, which are just the names of the standards.

Comment thread design/20261007.mldsa-private-keys.md Outdated

- Kubernetes: every version supported by the cert-manager release. Nothing here depends on Kubernetes.
- Go: cert-manager is built with Go 1.27.1+, and its `go.mod` files require Go 1.27, including for library consumers.
- FIPS: Go FIPS 140-3 module v1.26.0 or later is required for ML-DSA (in process for validation as of Go 1.27.1).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: As above, remove FIPS

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, along with the other FIPS 140 mentions elsewhere in the doc. The only remaining references are FIPS 204/205, which are just the names of the standards.

Drop the proposed MLDSA44/65/87 signature algorithm values, since each
ML-DSA key allows only one signature algorithm and the issued
certificate's signature is decided by the signer. Require
signatureAlgorithm to be unset for ML-DSA keys instead.

Target beta in v1.23 and GA in v1.24, without fixed waiting periods,
and remove FIPS-related content.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
@lukevalenta

Copy link
Copy Markdown

I reviewed the plan and think it's good! No notes.

@misiektoja

misiektoja commented Oct 9, 2026 •

Copy link
Copy Markdown

Thanks for putting this together. We have been using an internal cert-manager fork with ML-DSA and composite ML-DSA support for some of our projects for some time now (disclosure: I work at Nokia). There are two things we had to handle internally that the design doesn't cover yet:

1. ML-DSA needs different default key usages. With usages unset, cert-manager defaults to digital signature and key encipherment. RFC 9881 Section 5 forbids keyEncipherment, dataEncipherment, keyAgreement, encipherOnly and decipherOnly for certificates with ML-DSA subject public keys. Go 1.27.1 doesn't enforce this. Retaining these defaults for algorithm: MLDSA would produce non-compliant certificates with the built-in SelfSigned and CA issuers. #8527 also retains these defaults. We default ML-DSA to digital signature (plus cert sign for CAs) and reject the forbidden usages in the webhook and in the SelfSigned and CA signers. These defaults must be consistent across CSR generation, CertificateRequest validation and signing: GenerateCSR encodes usages by default and the webhook and built-in signers reject mismatches between encoded CSR usages and the CertificateRequest's usages.

2. The e2e runner needs the gate too. make/e2e-setup.mk configures gates for the deployed components. The test runner has its own feature_gates defaults in make/e2e.sh, so enabling the gate only in the cluster would leave conformance cases that call RequireFeatureGate skipped with the default make e2e configuration. Add MLDSAPrivateKeys=true to the runner's defaults as well, as is done for OtherNames.

UPDATE: And one more thought on the API. In our fork we went with separate MLDSA44, MLDSA65 and MLDSA87 algorithm values instead of MLDSA plus size, mainly because:

  • In X.509 the parameter sets are separate algorithms. RFC 9881 gives each its own OID (id-ml-dsa-44, -65, -87) with no parameters, the same model as Ed25519 and Ed448, and cert-manager already treats Ed25519 as its own algorithm.
  • 44, 65 and 87 are parameter set names, not sizes. For RSA and ECDSA, size is the key or curve size in bits, so size: 65 would be the first value in that field that isn't a size.

@SgtCoDFish SgtCoDFish left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three fairly minor AI findings which i think are probably worth some attention - I wouldn't normally paste so much raw claude output but I know your workflow and I think this will be as helpful as me reframing it 😁


  1. The "Go version" section is already stale (:177-185)

Master merged 0ce14bd ("Bump the go directive to 1.27", PR #9440, same author) yesterday. All eight go.mod files are on go 1.27.0 on master, and .golangci.yaml already disables modernize/embedlit. The section still reads as future work:

▎ the go directive moves from 1.26.0 to 1.27.0 in every go.mod
▎ The bump is a small standalone PR, which can merge independently of the ML-DSA work.
▎ #8527 also moves the go directive to 1.27. Whichever PR merges first makes that change, and the other is rebased.

Rewrite in the past tense and link #9440. The "whichever merges first" paragraph should go entirely — it's resolved. (The branch is based on 363e374, before the merge, so this is just a rebase artefact.)


  1. The Issuers table oversells pass-through for ACME and Vault (:228)

Human note: This seems to just be an update to the plan which won't change much in impl, but it seems worth a quick fix.

The table says ACME/Vault/Venafi are "Not blocked by cert-manager. The ML-DSA CSR is sent unchanged and the CA accepts or rejects it." But §Key generation already notes — correctly — that ACME and Vault verify the issued certificate against the CSR. I confirmed those call sites:

  • pkg/controller/certificaterequests/acme/acme.go:249 → PublicKeyMatchesCertificate
  • internal/vault/vault.go:227 → PublicKeyMatchesCSR
  • pkg/controller/certificatesigningrequests/acme/acme.go:235 → PublicKeyMatchesCertificate

Both funnel into PublicKeysEqual, which errors on *mldsa.PublicKey today. So pass-through is not free: even if an ACME or Vault CA happily issues an ML-DSA certificate, cert-manager will fail the post-issuance check. Suggest adding a footnote to that table row — something like "requires the PublicKeysEqual change in §Key generation; without it these issuers fail after the CA has issued." That ordering matters: the CA will have burned an issuance.


  1. Prefer the explicit *mldsa.PublicKey case over the generic Equal fallback (:205)

(I snipped out the AI explanation here - I agree we should just use the explicit case)

Update the Go version section now that cert-manager#9440 has merged, note that
pass-through issuers need the PublicKeysEqual change, use explicit
ML-DSA cases for key comparison, add ML-DSA key usage defaults and
validation per RFC 9881, and enable the gate in the e2e test runner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
@FelixPhipps

Copy link
Copy Markdown
Member Author

Thanks @SgtCoDFish, all three were worth fixing.

  1. Go version: it's now in the past tense, links Bump the go directive to 1.27 #9440, and the "whichever merges first" paragraph is gone. I also removed the other places that still described the bump as part of this design: the Summary, the feat: Adds ML-DSA post-quantum signature algorithm support #8527 section, a Risks row, a Drawbacks bullet, and Alternative 5, which now says it was considered before Bump the go directive to 1.27 #9440. The embedlit line links Apply the modernize embedlit fixes #9441, which applies the fixes.
  2. Pass-through: there's now a note under the Issuers table saying pass-through needs the PublicKeysEqual change, and that without it issuance fails after the CA has already issued. While checking this I found it's wider than ACME and Vault. The issuing controller also calls PublicKeysEqual(x509Cert.PublicKey, csr.PublicKey) for every issuer before writing the Secret, so Venafi and external issuers would hit it too. ACME also deletes the Order when the check fails, so each retry places a new order.
  3. Key comparison: it now uses explicit cases only, *mldsa.PublicKey in PublicKeysEqual and *mldsa.PrivateKey in PublicKeyForPrivateKey (as feat: Adds ML-DSA post-quantum signature algorithm support #8527 has), with no generic fallback, so unknown key types still return an error.

I've also added ML-DSA key usage defaults and the e2e runner gate from @misiektoja's comment.

@FelixPhipps

Copy link
Copy Markdown
Member Author

Thanks @misiektoja, this is really useful, especially coming from a fork that's already running ML-DSA.

1. Key usages: agreed, and I've added a Key usages section to the design. I confirmed Go 1.27.1 happily creates an ML-DSA certificate with keyEncipherment. The design now:

  • defaults ML-DSA to digital signature, plus cert sign for CAs, and leaves the RSA, ECDSA and Ed25519 defaults alone
  • rejects the forbidden usages in the webhook, for Certificates with algorithm: MLDSA and CertificateRequests with an ML-DSA CSR
  • rejects them in SignCertificate, which all four built-in signers use, including the CertificateSigningRequest signers that skip the webhook
  • picks the defaults from the key algorithm everywhere they're applied (GenerateCSR, the CertificateRequest webhook and the certificate templates), so the encoded CSR usages and the CertificateRequest always agree

One more place needed the same fix: the Ingress/Gateway shim writes DefaultKeyUsages() explicitly into the Certificates it creates, so it has to write the ML-DSA default instead.

2. e2e runner gate: good catch, added. The design now includes MLDSAPrivateKeys in make/e2e.sh's defaults and in make/e2e-setup.mk.

@misiektoja

misiektoja commented Oct 9, 2026 •

Copy link
Copy Markdown

Thanks @FelixPhipps, I'm glad I could help.

BTW, I edited my comment afterwards to add a point about algorithm naming, so it may have been missed. I know the design covers this as Alternative 2 and that MLDSA plus size mirrors Go's single x509.MLDSA the same way ECDSA mirrors x509.ECDSA. Where I think it might be challenging is composite ML-DSA.

draft-ietf-lamps-pq-composite-sigs is in the RFC Editor queue and defines 18 fixed combinations, each with its own OID, such as MLDSA65-ECDSA-P256-SHA512 or MLDSA87-Ed448-SHAKE256. I know composites are a non-goal here and Go only covers pure ML-DSA for now (golang/go#78888 leaves composites to a separate proposal), but if cert-manager adds them later, size can't describe both components, so composites would need named values such as MLDSA65-ECDSA-P256. Pure ML-DSA would then use algorithm plus size while composites use named values.

Would it be worth deciding how composites would fit before the alpha API ships? Named values for both, such as MLDSA65 and MLDSA65-ECDSA-P256, would keep one model with one value per OID. Curious what others think.

@FelixPhipps

Copy link
Copy Markdown
Member Author

Thanks @misiektoja, I did miss the edit, sorry.

There's a fair case for named values:

  • Separate OIDs. ML-DSA-44, -65 and -87 each have their own OID with no parameters, which makes them closer to Ed25519 than to ECDSA, where the curve is a parameter of one algorithm. cert-manager already models Ed25519 as its own algorithm value.
  • Future algorithms. As you say, size can't describe composites, and it can't describe SLH-DSA either: FIPS 205 has 12 parameter sets, which vary by hash (SHA2/SHAKE) and by small/fast as well as by security level. Neither is in scope here, but if either is added later, ML-DSA would be the only post-quantum algorithm using size.
  • size isn't a size here. For RSA and ECDSA it's a length in bits, so 65 would be the first value that isn't.
  • #8527 already uses named values, so switching would mean less rework.

Even so, I still lean towards algorithm: MLDSA plus size. It matches Go's single x509.MLDSA, keeps the enum short, and gives a sensible default (44) without users having to choose. cert-manager also already mixes both models (size for RSA and ECDSA, a named value for Ed25519). Designing around composites, which aren't standardised yet and aren't in Go, also feels a bit speculative.

It's ultimately a maintainer decision, and either way it's worth settling before alpha, while it's still cheap to change.
@SgtCoDFish, what do you think? If we keep size, I'll add a note to the design saying that composites and SLH-DSA would use named values, so the mixed model is a deliberate choice.

@SgtCoDFish

Copy link
Copy Markdown
Member

@SgtCoDFish, what do you think? If we keep size, I'll add a note to the design saying that composites and SLH-DSA would use named values, so the mixed model is a deliberate choice.

I think the most convincing argument for size is that it lets us pick a sane default for users (and change that default later if security needs require us to) whereas giving 3 named values forces every user to understand the tradeoffs between the different ML-DSA variants. I guess we could just document what we think a sane default is, but that's still an extra step that users have to take.

The name size sucks for ML-DSA true, but it sucks for ECDSA too as already noted where "size" actually means "curve".

My gut says stick with size, just because it feels better for users if they only need to know "ML-DSA is post-quantum, let's use that" and they don't need to pick 44 vs 65 or whatever.

Looking forwards to composites it's definitely fair to say that an integer size is tricky there (I can imagine ways of making it work but they're all pretty ugly). I think we have that problem whatever we do here though - and if we agree that having the ability for the cert-manager team to choose a sane default is valuable, I don't think we should remove that value today for a future composites API which may require more changes anyway.

I wouldn't die on this hill, but it seems fine to use size for this to me.

@misiektoja

Copy link
Copy Markdown

Thanks both, that makes sense. Being able to pick a sane default and change it later is the stronger argument.

BTW, if a future release changes the ML-DSA default from 44 to let's say 65, there is an upgrade implication for users already relying on the old default. The proposed default isn't stored in the Certificate, so existing ML-DSA-44 keys would no longer match Certificates that omit size. With rotationPolicy: Always, this would trigger re-issuance with new keys as those Certificates are reconciled after the upgrade. With Never, re-issuance would be blocked with a CannotRegenerateKey warning. Maybe the Upgrade / Downgrade Strategy section should note this and describe how existing Certificates should migrate if the default changes?

Record the decision to keep algorithm: MLDSA plus size, note that
composite ML-DSA and SLH-DSA would use named values, and describe what
a future change to the default parameter set would mean for existing
Certificates and how users can prepare.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
@FelixPhipps

Copy link
Copy Markdown
Member Author

Thanks @SgtCoDFish, that's a convincing reason. Being able to choose a sensible default and change it later is the main advantage, and named values would lose it. I've kept size and updated Alternative 2 with that reasoning. It now also says that composites and SLH-DSA would use named values, so the mixed model is a deliberate choice.

@FelixPhipps

Copy link
Copy Markdown
Member Author

Good point @misiektoja, thanks. I've added it to the Upgrade / Downgrade Strategy section, and noted that RSA and ECDSA defaults already work this way. If a later release changes the default, Certificates that leave size unset are re-issued with new keys straight away under rotationPolicy: Always. Under Never, they go not Ready with CannotRegenerateKey until the user acts, while the existing Secret keeps working.

The design doesn't add a migration mechanism now, since the default may never change. Instead it says a change would be called out in the release notes, and explains how to prepare: set size to the old default before upgrading (or the cert-manager.io/private-key-size annotation for Ingress and Gateway Certificates), and how to unblock a Never Certificate that's already stuck.

@SgtCoDFish SgtCoDFish left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

I think this covers the topic thoroughly and helpfully. I'm happy with this personally. I'm sure that our understanding here will evolve as this work goes on, which makes it all the better that this code will be feature flagged so we'll have the option!

Great stuff!

@cert-manager-prow cert-manager-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Oct 12, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SgtCoDFish

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 12, 2026
@SgtCoDFish

Copy link
Copy Markdown
Member

/override pull-cert-manager-master-e2e-v1-37

Known issue with v1.37 tests: #9462

This is a design doc so there's no value to seeing a passing e2e here.

@cert-manager-prow

Copy link
Copy Markdown
Contributor

@SgtCoDFish: Overrode contexts on behalf of SgtCoDFish: pull-cert-manager-master-e2e-v1-37

Details

In response to this:

/override pull-cert-manager-master-e2e-v1-37

Known issue with v1.37 tests: #9462

This is a design doc so there's no value to seeing a passing e2e here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@cert-manager-prow
cert-manager-prow Bot merged commit ef9ac73 into cert-manager:master Oct 12, 2026
6 checks passed
cert-manager-prow Bot pushed a commit that referenced this pull request Oct 27, 2026
* Add ML-DSA post-quantum signature algorithm support

Signed-off-by: siddhi bhor <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

* Implement ML-DSA private keys per the merged design

Build on the original ML-DSA proof of concept so that it follows the
design merged in #9436:

- Add the alpha MLDSAPrivateKeys feature gate to the controller and
  webhook, and reject MLDSA key algorithms when it is disabled.
- Use size to select the ML-DSA parameter set (44, 65 or 87, default 44)
  and validate it.
- Generate, encode, parse and match ML-DSA keys with the Go standard
  library, and create and verify CSRs signed with ML-DSA.
- Sign with ML-DSA in the SelfSigned and CA issuers, including the
  Kubernetes CertificateSigningRequest signers, and default key usages
  to digital signature for ML-DSA keys.
- Handle ML-DSA keys in the re-issuance policies, key manager
  and certificate-shim annotations.
- Add unit tests and e2e/conformance coverage behind the feature gate.

Signed-off-by: Felix Phipps <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Set the issuer helper in the readiness controller's NewController

Only controllerWrapper.Register set the helper, so callers of
NewController, such as the integration tests' runAllControllers,
panicked in useARIForRenewal once a Secret held a certificate.
NewController now sets a helper that can get Issuers, and Register
still replaces it with one that can also get ClusterIssuers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

* Add ML-DSA integration tests and correct the shim design

Add the integration tests from the design's test plan: renewal under
rotationPolicy Always and Never, including a parameter set change;
controller restart without re-issuance; turning the MLDSAPrivateKeys
feature gate off and back on; and the CombinedPEM, DER, PKCS#12 and JKS
outputs. runAllControllersWithRecorder lets tests check events.

The design said invalid ML-DSA shim annotations would record the
existing BadConfig event, but invalid annotations have never recorded
an event. ML-DSA errors take the same path as other invalid
annotations: logged and retried, with no Certificate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

* Fix lint errors in the ML-DSA integration tests

Group the cert-manager imports with the other modules, as gci expects in
the integration-tests module, and replace issueRevision's crtName
parameter, which was always "mldsa", with a package-level constant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

* Skip ML-DSA CSR conformance tests on API servers older than Go 1.27

kube-apiserver checks a CertificateSigningRequest's signature when it's
created, and Kubernetes v1.37 is built with Go 1.26, which can't check
ML-DSA signatures. It rejects ML-DSA CertificateSigningRequests with
"x509: cannot verify signature: algorithm unimplemented", so the ML-DSA
cases in the CertificateSigningRequests conformance suite failed.

Add RequireServerGoVersion to the e2e framework, and skip those cases
when the API server was built with Go older than 1.27. They run again
by themselves once Kubernetes is built with Go 1.27. Document the
limitation in the design.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

* Address review comments on ML-DSA private keys

- Make @SgtCoDFish and @FelixPhipps the owners of the MLDSAPrivateKeys
  feature gate.
- Replace ForbiddenKeyUsagesForPublicKeyAlgorithm, which filtered a list,
  with the KeyUsageAllowedForPublicKeyAlgorithm predicate, so validation
  no longer builds a one-element slice for each usage.
- Note on maxCACertificatePEMSize that ML-DSA CA certificates are larger
  than it, and why that's fine. The limits don't change.
- Test ML-DSA-87 chains right up to the chain size limit, using a fixed
  certificate from testdata instead of generating keys.
- Fix stale key type lists in pki doc comments, and a missing quote in
  an error message.
- Pass a context to RequireServerGoVersion and use
  ServerVersionWithContext.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

* Address hjoshi123's review comments on ML-DSA gate checks

- Leave CertificateRequests stopped by the MLDSAPrivateKeys gate Pending
  rather than Failed in the CA and SelfSigned issuers, so they're signed
  without failure backoff once the gate is turned back on.
- Mark a CA issuer whose CA key is ML-DSA as not Ready, with reason
  MLDSAPrivateKeysDisabled, while the gate is off.
- Make logging in the CertificateSigningRequest signers' gate checks
  match the CertificateRequest issuers.
- Update the design doc to match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

* Address wallrj's review comments on ML-DSA private keys

- Reject every non-zero ML-DSA size other than 44, 65 or 87 in the
  webhook, and apply the ML-DSA-44 default in MLDSAParametersForSize
  only, so key generation, key matching and CSR generation agree.
- Skip the ML-DSA CA e2e specs before creating the Issuer when the
  feature gate is disabled, and tolerate NotFound in their cleanup.
- Build the readiness controller's issuer helper once in NewController,
  including the ClusterIssuer lister.
- Deprecate KeyUsagesForCertificateOrCertificateRequest.
- Re-queue ML-DSA Certificates that must be re-issued every 30 minutes
  while the MLDSAPrivateKeys gate is disabled, so the warning event
  doesn't expire.
- Reword the privateKey.algorithm doc line and regenerate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

* Apply the modernize embedlit fixes to the ML-DSA code

master now enables golangci-lint's modernize/embedlit check and has
dropped the metav1 import from the CA e2e fixtures, so the ML-DSA
fixture no longer compiled after merging master. Omit the embedded
ObjectMeta type from the struct literals this branch adds, as master
does, using make fix-golangci-lint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>

---------

Signed-off-by: siddhi bhor <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
Co-authored-by: siddhi bhor <[email protected]>
Co-authored-by: Felix Phipps <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/design Categorizes issue or PR as related to design. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants