Sanniv Khare 7 min read

Post-quantum TLS on Android: what Conscrypt and OkHttp do now

Post-quantum TLS on Android: what Conscrypt and OkHttp do now

Short answer: on Android, whether your app’s HTTPS traffic offers the post-quantum hybrid X25519MLKEM768 is decided by the phone’s Conscrypt module, not by your code. Since Conscrypt 2.8.0 (19 Oct 2026) the OS build of Conscrypt puts X25519MLKEM768 first in its default group list, but only when a release flag and an app-compat change are both on. OkHttp 5.5.1 has no API of its own for key-exchange groups, so it inherits whatever Conscrypt offers. You do not need to change anything for this to work, and certificate pinning is not affected.

This is a source review: we cloned Conscrypt (tags 2.7.0, 2.8.0, 2.9.0 and main at 24 Nov 2026), BoringSSL (main at 3 Dec 2026) and OkHttp (master at 2 Dec 2026), and read the API level 37 reference for SSLParameters.

Why we did this: the NSA advisory this week (reported by The Hacker News on 3 Dec) put “are we post-quantum yet?” on the list for the Beacon-type banking apps we build, and two sources gave opposite answers. One vendor matrix (PostQuantumField) says Conscrypt ships the hybrid through Mainline to Android 12 and later; an open OkHttp feature request says Conscrypt on Android did not support it as of Android 17 Beta 4. The source code explains why both look right. We covered the same question for iOS in Post-quantum TLS on iOS 26 and for servers in Post-quantum TLS on nginx.

Two Conscrypts, two answers

Conscrypt exists in two shapes that share most of their code:

  • The OS build (platform/ in the repo). This is the TLS provider behind HttpsURLConnection and OkHttp on every Android phone. It ships as an updatable Mainline module, so Google can change it without an OS update.
  • The app build (android/ in the repo, published as org.conscrypt:conscrypt-android). An app can bundle it and install it as its own security provider. There is also a JVM build (openjdk/).

Both builds can speak X25519MLKEM768: the name maps to BoringSSL’s NID_X25519MLKEM768 in NativeSsl.toBoringSslGroup() in every tag we checked from 2.7.0 on. The difference is the default, which is what an app gets when it does nothing.

Conscrypt tags 2.7.0 to main: how the default named groups are decided in the OS build and in the app AAR

How the default changed across four Conscrypt versions, read from the source.

In the app build the field pqcDefaultEnabled is true in 2.8.0, 2.9.0 and main. In 2.7.0 there is no switch at all: Conscrypt passes an empty list and BoringSSL uses its own defaults. BoringSSL’s DefaultSupportedGroupIds() on main (3 Dec 2026) lists X25519_MLKEM768 first, then X25519, P-256 and P-384.

The switch in the OS build

The OS build is different. Its Platform.isPqcDefaultEnabled() has two gates:

Conscrypt's isPqcDefaultEnabled in the platform build: an aconfig flag, then compat change ENABLE_TLS_PQC_DEFAULT_GROUPS

The gate as it reads in Conscrypt main; the same method is in 2.8.0 and 2.9.0.

  1. Flags.tlsPqcDefaultNamedGroups(): a release flag. Its value is set where Android is built and rolled out, not in the open-source repo, so the code alone cannot tell you whether a given phone has it on.
  2. Compat change ENABLE_TLS_PQC_DEFAULT_GROUPS (ID 556729260). The source comment says it is enabled by default for every targetSdkVersion and can be overridden per app on debuggable builds and in Developer Options.

When both are on, the default list is the pinned X25519MLKEM768, X25519, P-256, P-384 (in main; 2.8.0 and 2.9.0 fall back to BoringSSL’s list instead). When the flag is off, the OS build offers X25519, P-256, P-384 only. The comment above the lists says why Google is careful here: changing the default changes the ClientHello on the wire, which can break handshakes with old middleboxes. On our own test server the PQ ClientHello was 1,535 bytes against 304 without it (see the nginx post).

So the two sources are describing different things. The capability reached the OS Conscrypt through the module; whether it is the default on a particular phone today depends on a flag Google rolls out, and an Android 17 beta could easily have had it off. Treat “Android 12+ has it” as “Android 12+ can get it”, not as a fact about every device in your user base.

Where an app can step in

Conscrypt picks the group list in this order, in NativeSsl.initialize():

Lookup order: SSLParameters.setNamedGroups, then the jdk.tls.namedGroups system property, then the defaults

An explicit list wins; the defaults are the last resort.

  • SSLParameters.setNamedGroups(): added to Android in API level 37. Unknown names are ignored; null means provider defaults; an empty array turns group negotiation off, which will break TLS 1.3, so never pass one.
  • The jdk.tls.namedGroups system property: Conscrypt parses it when no explicit list is set. On Android this is mostly useful in JVM unit tests.
  • The defaults described above.

On API 37 you can pin the list yourself. Treat this as a starting point and compile it against your own socket factory:

// Only on API 37+: put the hybrid first, keep classical fallbacks.
fun SSLSocket.preferPostQuantum() {
    if (Build.VERSION.SDK_INT >= 37) {
        val p = sslParameters
        p.namedGroups = arrayOf("X25519MLKEM768", "X25519", "P-256")
        sslParameters = p
    }
}

The same call is how you would opt one host out if a corporate proxy chokes on the larger ClientHello: give that socket arrayOf("X25519", "P-256").

OkHttp: nothing to set, nothing to break

OkHttp 5.5.1 (22 Oct 2026) and master at 2 Dec have no named-groups setting: ConnectionSpec controls TLS versions and cipher suites only, and a search of the source for namedGroups finds nothing. On Android OkHttp creates its sockets from the platform SSLContext, so it gets the OS Conscrypt defaults described above. The feature request linked earlier proposes ConnectionSpec.Builder.namedGroups(); until something like it lands, the API 37 call above (through a wrapping SSLSocketFactory) is the only per-client control.

Conscrypt 2.9.0 (4 Nov 2026) added Conscrypt.getGroupName(SSLSocket), which reports the group a finished handshake used. If you bundle the app build of Conscrypt in a debug build, a network interceptor can log it. This shows what the bundled 2.9.0 negotiates, not what the phone’s own Conscrypt does:

// Debug builds only, with org.conscrypt:conscrypt-android:2.9.0
Security.insertProviderAt(Conscrypt.newProvider(), 1)

val client = OkHttpClient.Builder()
    .addNetworkInterceptor { chain ->
        val s = chain.connection()?.socket()
        if (s is SSLSocket && Conscrypt.isConscrypt(s)) {
            Log.d("TLS", "group=" + Conscrypt.getGroupName(s))
        }
        chain.proceed(chain.request())
    }
    .build()

WebView and Cronet use Chromium’s network stack with its own BoringSSL configuration, so their behaviour follows Chrome rather than Conscrypt; they are outside this post.

What we decided for a banking app

  • Change nothing in release builds. The hybrid is negotiated only when both sides support it. X25519 stays in the offered list, so a server without the hybrid simply picks the classical group.
  • Pinning stays as it is. X25519MLKEM768 changes the key exchange, not the certificate chain, so SPKI pins and network_security_config pins are unaffected. If you pin, also read Android 17 turns on CT and ECH.
  • Turn it on at the server first. A phone can only use the hybrid if your API offers it. For nginx with OpenSSL 3.5 that is one ssl_ecdh_curve line.
  • Watch the server log, not the app. Logging $ssl_curve on the server tells you what share of real clients already negotiate the hybrid, which is a better answer to “are we post-quantum yet” than any device matrix.

What to check on your own app

  1. Search your code for setNamedGroups, jdk.tls.namedGroups and Security.insertProviderAt: anything there overrides the OS defaults described here.
  2. If you bundle conscrypt-android, note its version: 2.8.0 and later default to the hybrid regardless of the OS flag.
  3. Add $ssl_curve (nginx) or the equivalent to your API’s access log and look for X25519MLKEM768 from Android user agents.
  4. When you move to targetSdk 37, decide whether you want an explicit group list, and keep the classical groups in it.

Made by the team behind this post

Apps from our studio

  • Goes with this post

    BMDB.fun

    Your Bollywood world at a glance, with links straight to the OTT app that streams each film.

    Android TV · Web · Mobile

    Get
  • Nix

    The Mac uninstaller that finds what the Trash leaves behind: caches, logs, derived data and saved states.

    macOS

    Get
  • Cardigami

    Pop-up greeting cards that rise out of the fold on iPhone Duo.

    iPhone · App Store

    Get
  • OneClick QuitAll

    Quit every running app in one click. See memory and CPU first.

    macOS · Mac App Store

    Get

Need this built? Let’s talk.

We build and run apps for Mac, TV, mobile and the web, and write about what we learn.