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.