diff --git a/ca/ca.go b/ca/ca.go index 9ac43c14..4b55c739 100644 --- a/ca/ca.go +++ b/ca/ca.go @@ -115,6 +115,8 @@ func makeKey(keyAlg string) (crypto.Signer, []byte, error) { key, err = rsa.GenerateKey(rand.Reader, 2048) case "ecdsa": key, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + case "mldsa": + key, err = mldsaGenerateKey() } if err != nil { return nil, nil, err diff --git a/ca/ca_mldsa.go b/ca/ca_mldsa.go new file mode 100644 index 00000000..84426379 --- /dev/null +++ b/ca/ca_mldsa.go @@ -0,0 +1,12 @@ +//go:build go1.27 + +package ca + +import ( + "crypto" + "crypto/mldsa" +) + +func mldsaGenerateKey() (crypto.Signer, error) { + return mldsa.GenerateKey(mldsa.MLDSA65()) +} diff --git a/ca/ca_mldsa_stub.go b/ca/ca_mldsa_stub.go new file mode 100644 index 00000000..bb5a5a5d --- /dev/null +++ b/ca/ca_mldsa_stub.go @@ -0,0 +1,13 @@ +//go:build !go1.27 + +package ca + +import ( + "crypto" + "fmt" +) + +// crypto/mldsa is not available before Go 1.27 +func mldsaGenerateKey() (crypto.Signer, error) { + return nil, fmt.Errorf("unsupported key algorithm: mldsa") +} diff --git a/cmd/pebble/main.go b/cmd/pebble/main.go index 45ffaa7d..fca24950 100644 --- a/cmd/pebble/main.go +++ b/cmd/pebble/main.go @@ -110,7 +110,7 @@ func main() { if keyAlg == "" { keyAlg = "rsa" } - acceptableKeyAlgs := []string{"rsa", "ecdsa"} + acceptableKeyAlgs := []string{"rsa", "ecdsa", "mldsa"} if !slices.Contains(acceptableKeyAlgs, keyAlg) { cmd.FailOnError(fmt.Errorf("%q is not one of %#v", keyAlg, acceptableKeyAlgs), "invalid key algorithm") } diff --git a/wfe/wfe_mldsa.go b/wfe/wfe_mldsa.go new file mode 100644 index 00000000..97cfa512 --- /dev/null +++ b/wfe/wfe_mldsa.go @@ -0,0 +1,13 @@ +//go:build go1.27 + +package wfe + +import ( + "crypto/x509" +) + +func init() { + goodSignatureAlgorithms[x509.MLDSA44] = true + goodSignatureAlgorithms[x509.MLDSA65] = true + goodSignatureAlgorithms[x509.MLDSA87] = true +}