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 Last reviewed 2026-12-04

How this guide was validated. Run on 2026-12-04 at 3:31 PM ET, loopback only, inside a network sandbox: a Go 1.27.4 (darwin/arm64) crypto/tls server, TLS 1.3, with a throwaway ECDSA P-256 certificate generated in memory (no key written to disk). Clients: OpenSSL 3.6.2 s_client (default offer) and OpenSSL 4.1.0 s_client -groups X25519. CurvePreferences nil: X25519MLKEM768 (X25519 for the X25519-only client). Explicit X25519MLKEM768, X25519, P-256: the same. X25519 only: X25519. GODEBUG=tlsmlkem=0: X25519. The same program with go 1.23 in go.mod: X25519, and X25519MLKEM768 again with GODEBUG=tlsmlkem=1. go version on the binary printed go1.27.4. Not run: Go 1.24 to 1.26, other operating systems, Go as a TLS client, or a production setup.

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

  1. Check the Go version the binary was built with
    X25519MLKEM768 support and its default arrived in Go 1.24.
    go version ./yourbinary

    Expect: ./yourbinary: go1.24 or later. In the lab: go1.27.4.

  2. 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

    Expect: go 1.24 or later.

  3. 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' .
  4. 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

  1. 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"

    Expect: "Negotiated TLS1.3 group: X25519MLKEM768", as seen in the lab with OpenSSL 3.6.2. A server limited to X25519 showed "Peer Temp Key: X25519, 253 bits" instead.

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?.

The checker tests the public HTTPS endpoint on port 443 of the exact hostname you enter. Mail (SMTP, IMAP) and other ports are not covered by it.

Roll back

  1. 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

Only change systems you own or are authorized to change. Have a person approve each change and keep a rollback.