isquantumsafe Check a domain

isquantumsafe / Guides / Go (crypto/tls)

Post-quantum TLS on Go (crypto/tls)

Go 1.24+ crypto/tls enables X25519MLKEM768 hybrid post-quantum key exchange (ML-KEM) by default. How CurvePreferences and GODEBUG affect it, and how to test it.

Default
On by default
You need
Go 1.24 (X25519MLKEM768); Go 1.26 adds SecP256r1MLKEM768 and SecP384r1MLKEM1024 to the defaults
Updated
4 December 2026 · 4 sources

Go's crypto/tls enables X25519MLKEM768 by default from Go 1.24, as long as Config.CurvePreferences is nil. Go 1.26 also added SecP256r1MLKEM768 and SecP384r1MLKEM1024 to the defaults. Most Go servers built with a current toolchain are already post-quantum.

Requirements

  • Go 1.24 or newer to build your binary. The toolchain version at build time is what matters, not the Go installed on the server.
  • TLS 1.3, which crypto/tls enables by default.
  • No GODEBUG=tlsmlkem=0 in the environment or in a //go:debug directive.

Check the Go version a binary was built with:

go version ./myserver

Enable it

Leave CurvePreferences unset and the defaults apply. If you need an explicit list, put the hybrid first in the tls.Config you pass to your server:

srv := &http.Server{
	Addr: ":443",
	TLSConfig: &tls.Config{
		MinVersion: tls.VersionTLS12,
		CurvePreferences: []tls.CurveID{
			tls.X25519MLKEM768,
			tls.X25519,
			tls.CurveP256,
		},
	},
}
log.Fatal(srv.ListenAndServeTLS("cert.pem", "key.pem"))

The constants tls.SecP256r1MLKEM768 and tls.SecP384r1MLKEM1024 are also available if you need the NIST-curve hybrids.

To see the negotiated group on the server, read ConnectionState().CurveID from the *tls.Conn in a handler or a ConnState hook, and compare it with tls.X25519MLKEM768.

Check it worked

From a machine with an OpenSSL 3.5 or newer client:

openssl s_client -connect example.com:443 -servername example.com \
  -groups X25519MLKEM768 -tls1_3 </dev/null 2>/dev/null | grep -i "group"

You should see Negotiated TLS1.3 group: X25519MLKEM768.

Run a free check at https://isquantumsafe.net/ to see the negotiated group and your grade.

Common problems

  • Built with Go 1.23 or older. Rebuild with a current toolchain.
  • Explicit CurvePreferences without a hybrid. The package docs say setting CurvePreferences replaces the defaults. A list with only X25519 and CurveP256 turns ML-KEM off.
  • GODEBUG=tlsmlkem=0. This turns X25519MLKEM768 off. The Go 1.24 notes say it exists for buggy servers that time out on large handshake records. tlssecpmlkem=0 turns off the two NIST-curve hybrids.
  • An older go.mod language version. GODEBUG defaults follow the go line in your main module's go.mod. Go's GODEBUG table marks tlsmlkem as changed in 1.24 with the old value 0, so a go 1.23 line keeps ML-KEM off even with a new compiler. Raise the go line to 1.24 or newer, or add //go:debug tlsmlkem=1 to your main package.

Sources

  1. crypto/tls package documentation (pkg.go.dev)
  2. Go 1.24 release notes: crypto/tls
  3. Go 1.26 release notes: crypto/tls
  4. Go, Backwards Compatibility, and GODEBUG

Other guides: Languages and runtimes