pebble icon indicating copy to clipboard operation
pebble copied to clipboard

Allow ML-DSA roots and intermediates

Open aarongable opened this issue 2 months ago • 3 comments

Add support for using ML-DSA-65 to generate Pebble's root and intermediate keys and certificates.

This uses Cloudflare's "circl" library to handle generating ML-DSA keys, serializing pubkeys, and generating signatures. Specifically, it uses the mldsa44, mldsa65, and mldsa87 packages, as well as the abstractions provided by the sign and pki packages:

However, the Go stdlib crypto/x509 package does not support using these keys. Although they implement the crypto.Signer interface, the x509 package also needs to be able to map keys to PublicKeyAlgorithm and SignatureAlgorithm OIDs, and does not provide any hooks for crypto.Signers to provide that information. As such, this PR also forks the relevant portions of crypto/x509 (MarshalPKIXPublicKey, CreateCertificate, and ParseCertificate), strips them down to their bare bones, and then adds support for ML-DSA.

aarongable avatar Oct 02 '25 21:10 aarongable

We may need to fork crypto/x509

Forking individual package from Go's standard library is almost impossible, I tried. See the reason here.

As I already mentioned in https://github.com/golang/go/issues/64537, check out AgiliGo.

Muzosh avatar Oct 03 '25 10:10 Muzosh

Should this use assembly for the ML-DSA operations to prevent side-channel attacks? Or is that not an issue because production users will use an HSM?

DemiMarie avatar Oct 03 '25 18:10 DemiMarie

Should this use assembly for the ML-DSA operations to prevent side-channel attacks? Or is that not an issue because production users will use an HSM?

Pebble is not intended for production use; as documented in its README and as demonstrated by the fact that it generates its signing keys on startup and forgets them on shutdown, it is intended for testing and development use only. It's fine if its signing operations are not constant-time.

aarongable avatar Oct 03 '25 21:10 aarongable