isquantumsafe Check a domain

isquantumsafe / Guides / Node.js

Post-quantum TLS on Node.js

Node.js 24.5+ and 22.20+ bundle OpenSSL 3.5 and use X25519MLKEM768 hybrid post-quantum key exchange (ML-KEM) by default. How to set ecdhCurve and test it.

Default
On by default
You need
Node.js 24.5.0 or 22.20.0 (official builds with bundled OpenSSL 3.5)
Updated
4 December 2026 · 4 sources

Node.js uses OpenSSL for TLS, and its default ecdhCurve is auto, which means OpenSSL's built-in group list. Official Node.js 24.5.0+ and 22.20.0+ builds bundle OpenSSL 3.5, so a Node HTTPS server offers X25519MLKEM768 out of the box.

Requirements

  • Official Node.js 24.5.0 or newer (ships OpenSSL 3.5.1 or later), or Node.js 22.20.0 or newer (ships OpenSSL 3.5.2 or later). Later major lines also bundle OpenSSL 3.5+.
  • TLS 1.3 allowed. Node's default maximum is TLS 1.3.
  • If your Node is built against a system OpenSSL (common in Linux distribution packages), that library must be 3.5 or newer.

Check what you run:

node -p "process.versions.openssl"

Enable it

With the default settings, nothing is needed. If your code sets ecdhCurve, or you want the order explicit, list the hybrid group first where you create the server:

import https from 'node:https';
import fs from 'node:fs';

const server = https.createServer({
  key: fs.readFileSync('key.pem'),
  cert: fs.readFileSync('cert.pem'),
  minVersion: 'TLSv1.2',
  ecdhCurve: 'X25519MLKEM768:X25519:P-256',
}, (req, res) => {
  res.end('ok');
});

server.listen(443);

The Node docs describe ecdhCurve as a colon-separated list of named curves or TLS groups, and in TLS 1.3 it sets the supported groups and key shares. The same option works in tls.createServer() and tls.createSecureContext().

To change the default for every TLS context in a process, set tls.DEFAULT_ECDH_CURVE before creating servers.

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. From a Node client, the current docs say socket.getEphemeralKeyInfo() can report the negotiated group with type: 'TLSGroup' and the group in name.

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

Common problems

  • Older Node. Node 22 before 22.20.0 and Node 20 bundle OpenSSL 3.0, which has no ML-KEM. Upgrade.
  • Distribution builds with shared OpenSSL. Node.js 22.20.0's notes say third-party builds that link an external OpenSSL are not affected by the bundled upgrade. Check process.versions.openssl.
  • A pinned ecdhCurve. Values such as 'P-256:X25519' from old examples replace the defaults and turn ML-KEM off.
  • A proxy terminates TLS. If nginx, a load balancer or a CDN sits in front of Node, the visitor's key exchange happens there.

Sources

  1. Node.js TLS documentation (ecdhCurve, tls.DEFAULT_ECDH_CURVE)
  2. Node.js v24.5.0 release notes (OpenSSL 3.5)
  3. Node.js v22.20.0 (LTS) release notes (OpenSSL 3.5.2)
  4. OpenSSL 3.5 Series Release Notes

Other guides: Languages and runtimes