> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Does ClickHouse use post-quantum cryptography?

> Data at rest in ClickHouse is encrypted with AES, which a quantum computer does not break. Data in transit is protected by the hybrid post-quantum key exchange X25519MLKEM768 in TLS 1.3, negotiated by default and enforceable by configuration.

Yes. The confidentiality of data in ClickHouse does not depend on cryptography that a quantum computer breaks:

* **Data at rest** is encrypted with AES, a symmetric cipher. There is no key exchange and no public-key step, so there is nothing for a quantum computer to attack with Shor's algorithm.
* **Data in transit** is protected by TLS 1.3 with the hybrid post-quantum key exchange `X25519MLKEM768`. ClickHouse negotiates it by default with every client that supports it, starting from version 25.11, and can be configured to refuse everything else.
* **The SSH interface** negotiates a hybrid post-quantum key exchange as well, in current versions.

The rest of this page gives the details, the commands to check them on your own server, and the limits: what is not post-quantum yet, and why that matters less.

## What a quantum computer breaks

A large enough quantum computer affects two classes of cryptography differently:

* **Public-key cryptography based on factoring and discrete logarithms** (RSA, Diffie-Hellman, elliptic curves) is broken by Shor's algorithm. In TLS these algorithms do two jobs: the key exchange, which produces the keys that encrypt a session, and the signatures, which authenticate the server.
* **Symmetric cryptography and hash functions** (AES, ChaCha20, SHA-2) are only affected by Grover's algorithm, which speeds up a brute-force search quadratically at best. A 256-bit key keeps a 128-bit security margin even in that model.

The key exchange is the urgent part. An attacker can record encrypted traffic today and decrypt it once a quantum computer exists ("harvest now, decrypt later"), so data sent today under a classical key exchange is already exposed to a future machine. Signatures are different: forging one requires the quantum computer at the moment of the connection, and does nothing to sessions recorded in the past.

Post-quantum algorithms replace the vulnerable ones. NIST standardized the first three on 2024-08-13: ML-KEM for key exchange ([FIPS 203](https://csrc.nist.gov/pubs/fips/203/final)), and ML-DSA and SLH-DSA for signatures ([FIPS 204](https://csrc.nist.gov/pubs/fips/204/final), [FIPS 205](https://csrc.nist.gov/pubs/fips/205/final)).

## Data at rest

The encryption features for stored data use AES with a key that you provide:

| Feature | Algorithms | Key |
| - | - | - |
| [Encrypted disks](https://clickhouse.com/docs/concepts/features/configuration/server-config/storing-data.md#encrypted-virtual-file-system) | `AES_128_CTR` (default), `AES_192_CTR`, `AES_256_CTR` | `key` or `key_hex` of the disk in the server configuration |
| [Encryption codecs](https://clickhouse.com/docs/reference/statements/create/table/codec.md#encryption-codecs) for columns | `AES_128_GCM_SIV`, `AES_256_GCM_SIV` | [`encryption_codecs`](https://clickhouse.com/docs/reference/settings/server-settings/settings/other#encryption) in the server configuration |
| [`encrypt`, `decrypt`](https://clickhouse.com/docs/reference/functions/regular-functions/encryption-functions) and related functions | AES with 128, 192 or 256-bit keys in several modes | An argument of the function |

The key is read from the configuration or passed in the query, and is used directly to encrypt and decrypt. Nothing is negotiated and nothing is wrapped with a public key, so these features never depended on quantum-vulnerable cryptography.

Grover's algorithm is the only quantum attack that applies, and it is far from practical: [NIST considers it](https://csrc.nist.gov/projects/post-quantum-cryptography/faqs) "quite likely that Grover's algorithm will provide little or no advantage in attacking AES, and AES 128 will remain secure for decades to come". If your policy asks for a margin against it anyway, as [CNSA 2.0](https://media.defense.gov/2022/Sep/07/2003071834/-1/-1/0/CSA_CNSA_2.0_ALGORITHMS_.PDF) does, use 256-bit keys. For an encrypted disk, this means setting the algorithm explicitly, because the default is `AES_128_CTR`:

```xml theme={null}
<clickhouse>
    <storage_configuration>
        <disks>
            <disk_encrypted>
                <type>encrypted</type>
                <disk>disk_local</disk>
                <path>encrypted/</path>
                <algorithm>AES_256_CTR</algorithm>
                <key_hex>00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff</key_hex>
            </disk_encrypted>
        </disks>
    </storage_configuration>
</clickhouse>
```

Two things stay outside ClickHouse:

* **Delivery of the key.** If the key reaches the server from a secrets manager or a deployment system, the channel that carries it has to be post-quantum as well.
* **Encryption by the storage provider.** Server-side encryption of an object storage or a block device is done by the provider with its own keys. In ClickHouse Cloud, data at rest is encrypted with [AES-256 keys](https://clickhouse.com/docs/products/cloud/features/security.md#encryption).

## Data in transit

This section describes TLS as it is terminated by the ClickHouse server itself. A connection that goes through a TLS-terminating proxy or load balancer negotiates what that component supports: use the commands in [How to check](#how-to-check) to see what an endpoint does.

### What is negotiated by default

ClickHouse uses OpenSSL 3.5, which implements ML-KEM and prefers the hybrid group `X25519MLKEM768` ([RFC 10024](https://www.rfc-editor.org/rfc/rfc10024)) in TLS 1.3. The group combines two key exchanges, the classical X25519 and the post-quantum ML-KEM-768, and derives the session keys from both results.

The session stays secure as long as either of the two is unbroken. This is the reason to deploy a hybrid and not ML-KEM alone: lattice-based cryptography is younger than elliptic curves and its cryptanalysis is an active field of research, but no progress there can make a hybrid connection weaker than the classical one it replaces.

With the default configuration:

* The server accepts `X25519MLKEM768` and selects it whenever the client lists it as supported. It also selects it when the client's first guess was a classical key share: the server asks the client to retry with the hybrid group.
* ClickHouse as a client offers `X25519MLKEM768` first. This covers `clickhouse-client`, connections between servers for distributed queries and replication, and outgoing HTTPS connections such as the `url` and `s3` table functions.
* Both the server and the client fall back to a classical key exchange (X25519, NIST curves) or to TLS 1.2 if the other side supports nothing better.

This applies to every TLS port of the server: the HTTPS interface, the native protocol (`tcp_port_secure`), the interserver HTTPS port, the MySQL and PostgreSQL wire protocols, gRPC, and both the client port and the Raft port of ClickHouse Keeper.

The key exchange is the only part of TLS that changes. The data is encrypted by the same symmetric ciphers as before, `TLS_AES_256_GCM_SHA384` by default.

### Versions

The hybrid key exchange is available in every release built with OpenSSL 3.5 or later:

* ClickHouse 25.11 and later.
* The 25.8 LTS release, starting from 25.8.23.

Earlier versions, including 25.9 and 25.10, negotiate a classical elliptic-curve key exchange. To see what your server is built with:

```sql theme={null}
SELECT value FROM system.build_options WHERE name = 'OPENSSL_VERSION';
```

```text theme={null}
   ┌─value─┐
1. │ 3.5.9 │
   └───────┘
```

### It takes both sides

A key exchange is negotiated, so the client has to support the hybrid group too. Clients built on OpenSSL 3.5 or later do, and so do `clickhouse-client` 25.11 or later, Go 1.24 or later, and current versions of Chrome and Firefox. This is no longer exotic: as of 2026-12-01, Cloudflare [reports](https://blog.cloudflare.com/pq-is-still-safe/) that 73% of the human traffic it serves is post-quantum encrypted.

A client that does not support the hybrid group still connects, with a classical key exchange, unless you [require](#how-to-require-it) the hybrid.

### How to check

With OpenSSL 3.5 or later on the client machine, connect to any TLS port of the server:

```bash theme={null}
openssl s_client -connect clickhouse.example.com:9440 -brief </dev/null
```

```text theme={null}
CONNECTION ESTABLISHED
Protocol version: TLSv1.3
Ciphersuite: TLS_AES_256_GCM_SHA384
Peer certificate: CN=clickhouse.example.com
Hash used: SHA256
Signature type: rsa_pss_rsae_sha256
Verification: OK
Negotiated TLS1.3 group: X25519MLKEM768
```

The last line is the key exchange. `curl -v` prints it as well, as the third field:

```text theme={null}
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519MLKEM768 / RSASSA-PSS
```

To test that the server refuses a classical key exchange after you have [required](#how-to-require-it) the hybrid one, offer only X25519. The handshake must fail:

```bash theme={null}
openssl s_client -connect clickhouse.example.com:9440 -groups X25519 -brief </dev/null
```

### How to require it

By default the server prefers the hybrid key exchange but does not insist on it. To refuse classical key exchanges, restrict the list of TLS groups. The [`openSSL`](https://clickhouse.com/docs/reference/settings/server-settings/settings/other#openssl) section of the server configuration has no option for the list of groups, so it is set in an OpenSSL configuration file, which ClickHouse loads only if the `OPENSSL_CONF` environment variable points to it.

Create the file, for example `/etc/clickhouse-server/openssl-pq.cnf`:

```ini theme={null}
openssl_conf = openssl_init

[openssl_init]
ssl_conf = ssl_sect

[ssl_sect]
system_default = system_default_sect

[system_default_sect]
Groups = X25519MLKEM768
MinProtocol = TLSv1.3
```

Then set the variable for the server process. With systemd, run `sudo systemctl edit clickhouse-server` and add:

```ini theme={null}
[Service]
Environment=OPENSSL_CONF=/etc/clickhouse-server/openssl-pq.cnf
```

With Docker, pass `-e OPENSSL_CONF=/etc/clickhouse-server/openssl-pq.cnf` and mount the file. Restart the server afterwards.

Three things to know before you do this:

* **Keep `MinProtocol = TLSv1.3`.** Post-quantum groups exist only in TLS 1.3. If the list of groups is restricted while TLS 1.2 is still allowed, a TLS 1.2 client can no longer use an elliptic-curve key exchange and falls back to the RSA key exchange, which is neither post-quantum nor [forward secret](https://clickhouse.com/docs/resources/support-center/knowledge-base/general-faqs/perfect-forward-secrecy.md).
* **The setting covers the whole process**: all TLS ports listed above, and also the connections that the server makes as a client. Every peer must support the hybrid group, including other ClickHouse servers, object storage endpoints, and the sources of dictionaries and table functions. A peer that does not is refused with `handshake failure`.
* **Every client must support it**, otherwise it can no longer connect.

OpenSSL provides more post-quantum groups, which you can list in `Groups` separated by colons. `SecP256r1MLKEM768` and `SecP384r1MLKEM1024` are the hybrids with NIST curves from the same RFC, for policies that require those curves or ML-KEM-1024. Groups with ML-KEM alone, such as `MLKEM1024`, are available too, but they give up the protection of the classical part, so prefer the hybrids.

The same file works for `clickhouse-client` and other ClickHouse tools, if you want a client that refuses to connect to a server without a post-quantum key exchange.

## Authentication

Authentication is where classical cryptography remains, and where it is the least urgent to replace. The deadline is set by the arrival of the quantum computer and not by today's recordings: the transition plan of NIST ([IR 8547](https://csrc.nist.gov/pubs/ir/8547/final)) deprecates the quantum-vulnerable signature and key exchange algorithms after 2030 and disallows them after 2035.

* **Server certificates** are usually signed with RSA or ECDSA, like everywhere else on the Internet. Breaking them takes a quantum computer at the time of the connection, to impersonate the server, and reveals nothing about sessions recorded earlier. ClickHouse is ready for the replacement: it loads certificates with ML-DSA keys and authenticates TLS 1.3 connections with them, provided that your certificate authority issues them and your clients can verify them (OpenSSL 3.5 or later).
* **Passwords** are stored as hashes, such as `sha256_password` and `bcrypt_password`, which are not affected by Shor's algorithm.
* **SSH keys and client certificates** used to authenticate users rely on classical signatures, with the same reasoning as for server certificates.

## SSH interface

The [SSH interface](https://clickhouse.com/docs/concepts/features/connect-to-clickhouse/protocols/ssh.md) does not use TLS and has its own key exchange. With a current OpenSSH client it negotiates `mlkem768x25519-sha256`, a hybrid of ML-KEM-768 and X25519, in ClickHouse 26.7 and later, and in the LTS releases starting from 25.8.31 and 26.3.20.

Releases before that negotiate, depending on the version, either `sntrup761x25519-sha512`, which is also a hybrid post-quantum key exchange, based on Streamlined NTRU Prime, or the classical `curve25519-sha256`. To check, look for the `kex: algorithm` line in the output of `ssh -v`:

```text theme={null}
debug1: kex: algorithm: mlkem768x25519-sha256
```

## Summary

| | Algorithm | Post-quantum | Notes |
| - | - | - | - |
| Data at rest | AES-128, AES-192, AES-256 | Yes | Symmetric. Use 256-bit keys for a margin against Grover's algorithm. |
| TLS session encryption | AES-GCM, ChaCha20-Poly1305 | Yes | Symmetric. AES-256-GCM by default. |
| TLS key exchange | `X25519MLKEM768` | Yes | Default since 25.11 when the client supports it. Can be made mandatory. |
| SSH key exchange | `mlkem768x25519-sha256` | Yes | Default since 26.7 with current OpenSSH clients. |
| TLS and SSH authentication | RSA, ECDSA, Ed25519 | No | Not exposed to "harvest now, decrypt later". ML-DSA certificates are supported. |
| Password storage | SHA-256, bcrypt | Yes | Hash functions. |
