Typical messages
javax.net.ssl.SSLHandshakeException: Handshake failed javax.net.ssl.SSLHandshakeException: SSL handshake aborted: ssl=0x…: Failure in SSL library, usually a protocol error … tlsv1 alert protocol version ERR_SSL_VERSION_OR_CIPHER_MISMATCH (Chrome)
Not to be confused with Trust anchor for certification path not found or “Chain validation failed”. That is a problem with the certificate or the date, not the handshake, see Trust anchor not found.
What each Android version supports
| Android | TLS 1.2 | TLS 1.3 | Note |
|---|---|---|---|
| 4.1 to 4.4 | available, but not enabled by default | no | apps have to enable TLS 1.2 themselves |
| 5.0 to 9 | yes, default | no | ECDHE with AES-GCM from 5.0 |
| 10 and later | yes | yes |
Chrome on Android ships its own TLS library. So a site can work in the browser while apps on the same device, which use the system's TLS implementation, fail.
Causes on the server side
- Only TLS 1.3 allowed. For example
ssl_protocols TLSv1.3;in nginx or the “modern” profile. Every device before Android 10 is locked out. - Cipher list too narrow. With TLS 1.2, Android 5 to 9 need at least ECDHE with AES-GCM. A list with only ChaCha20 or exotic ciphers is not enough.
- Certificate type doesn't match the cipher list. An RSA certificate with only ECDSA ciphers (or the other way round) allows no handshake.
- TLS inspection by a firewall or proxy with its own outdated configuration between device and server.
- Ancient servers with only TLS 1.0 or 1.1: new apps, such as Outlook for Android, refuse them.
Fix
For almost every case, TLS 1.2 plus TLS 1.3 with ECDHE ciphers and AES-GCM or ChaCha20 is the right choice. It covers Android from 5.0 and is secure. The TLS config generator creates it for your server. For nginx, for example:
ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305; ssl_prefer_server_ciphers off;
The SSL check shows whether the server offers TLS 1.2 afterwards. To see what a particular device supports, open the browser TLS test on it. Keep the difference between Chrome and apps in mind.
Android 4.4: on the app side
On Android 4.4 the app has to enable TLS 1.2 itself. With Google Play services the easiest way is ProviderInstaller.installIfNeeded(context), which loads a current security provider. Without Play services the only option is a custom SocketFactory that enables TLS 1.2. Older devices usually also lack ISRG Root X1, see old Android devices and Let's Encrypt.
FAQ
Should I re-enable TLS 1.0 and 1.1?
No. TLS 1.2 is enough for Android from 5.0. Only Android 4.x devices without Play services still need TLS 1.0 and 1.1, and they usually fail on the root anyway.
Why does it work in Chrome on the same device?
Chrome uses its own TLS library with TLS 1.3 and current ciphers. Apps use the system implementation, which depends on the Android version.
Can an ECDSA certificate be the problem?
Rarely. Android has supported ECDSA for a long time. A cipher list that doesn't match the certificate type is the real problem.