Migration guide
Post-quantum key exchange in Go (crypto/tls)
Go 1.24 and later enable the hybrid group X25519MLKEM768 by default when tls.Config.CurvePreferences is nil, as long as the main module's go.mod says go 1.24 or later. Check the build's Go version, the go line, any explicit CurvePreferences and GODEBUG=tlsmlkem=0, then verify your public hostname with our check.
Lab validated
Applies to
- Go 1.24 and later crypto/tls servers and clients
Before you start
- Go 1.24 or later: both the toolchain that built the binary and the go line in the main module's go.mod.
Steps
- Check the Go version the binary was built with
X25519MLKEM768 support and its default arrived in Go 1.24.go version ./yourbinary - Check the go line in go.mod
GODEBUG defaults follow the Go version in the main module's go.mod, not only the toolchain. In the lab, a server built with Go 1.27.4 but with go 1.23 in go.mod negotiated X25519, not X25519MLKEM768. Raise the go line to 1.24 or later, or set GODEBUG=tlsmlkem=1.grep '^go ' go.mod - Look for an explicit CurvePreferences
If code sets tls.Config.CurvePreferences, that list decides which key exchanges are enabled. Leave it nil to use the defaults, or include tls.X25519MLKEM768. Go ignores the order of the list and uses its own preference order. In the lab, a list of only X25519 gave X25519.grep -rn 'CurvePreferences' --include='*.go' . - Look for GODEBUG=tlsmlkem=0
This setting turns off the default post-quantum key exchange; in the lab the server then negotiated X25519. It can come from the environment or from a //go:debug line in the program. Remove it to restore the default.env | grep GODEBUG grep -rn '//go:debug' --include='*.go' .
Verify
- Check from the command line
From another machine, with an OpenSSL 3.5 or later client.openssl s_client -connect example.com:443 -servername example.com -tls1_3 </dev/null 2>&1 | grep -E "Negotiated TLS1.3 group|Peer Temp Key"
Verify with our check
Run the public checker on your hostname at postquantumverified.com. It opens one TLS 1.3 handshake on port 443 and shows Verified (the server selected the hybrid group X25519MLKEM768), Not post-quantum (it selected a classical group) or Could not check. Each check gets a dated record at /verify/{hostname} that anyone can open again. If the result is not Verified, see Why did my check say Not post-quantum? and Why did my check say Could not check?.
Roll back
- Restore the previous setting
Put back the saved CurvePreferences or GODEBUG value and redeploy.
What this guide does not cover
- A key-exchange result says nothing about authentication: the certificate and its signature are a separate question, and certificate signatures are not made post-quantum by this change.
- Only the connection between the client and this endpoint is covered. A CDN or load balancer in front of it terminates the client connection itself. See cdn-edge-and-origin.
- Clients that do not offer the hybrid group will use a classical group. That is expected.
- From Go 1.26 the default also includes SecP256r1MLKEM768 and SecP384r1MLKEM1024; GODEBUG=tlssecpmlkem=0 turns those two off. Our check offers X25519MLKEM768 as its only hybrid group.
Sources
- Go 1.24 release notes: X25519MLKEM768 supported and enabled by default when CurvePreferences is nil
- Go crypto/tls package documentation
- Go, Backwards Compatibility, and GODEBUG (defaults follow the go.mod Go version; //go:debug lines)
- Go 1.26 release notes: SecP256r1MLKEM768 and SecP384r1MLKEM1024 enabled by default