Android SSL Handshake Failed when connecting to a web service using HTTPS

20k views Asked by At

My Android app connects to a web service on my server. Everything worked fine yesterday, but today I got the error.

I didn't make any changes to the web service, nor to the app. I suspect it's something wrong with my server, but don't know where to start.

I tested it on both Android 5 and Android 6 devices.

Here is the error:

HTTPClient: (TiHttpClient-3) [1136,1136] HTTP Error (javax.net.ssl.SSLHandshakeException): Handshake failed
[ERROR] :  TiHTTPClient: javax.net.ssl.SSLHandshakeException: Handshake failed
[ERROR] :  TiHTTPClient:    at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:396)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:103)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.Connection.connect(Connection.java:143)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:185)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:437)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:388)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaders(HttpURLConnectionImpl.java:150)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:194)
[ERROR] :  TiHTTPClient:    at java.net.URLConnection.getHeaderFieldInt(URLConnection.java:543)
[ERROR] :  TiHTTPClient:    at java.net.URLConnection.getContentLength(URLConnection.java:315)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getContentLength(DelegatingHttpsURLConnection.java:146)
[ERROR] :  TiHTTPClient:    at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getContentLength(HttpsURLConnectionImpl.java)
[ERROR] :  TiHTTPClient:    at ti.modules.titanium.network.TiHTTPClient.handleResponse(TiHTTPClient.java:159)
[ERROR] :  TiHTTPClient:    at ti.modules.titanium.network.TiHTTPClient.access$1200(TiHTTPClient.java:85)
[ERROR] :  TiHTTPClient:    at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1207)
[ERROR] :  TiHTTPClient:    at java.lang.Thread.run(Thread.java:818)
[ERROR] :  TiHTTPClient:    Suppressed: javax.net.ssl.SSLHandshakeException: Handshake failed
[ERROR] :  TiHTTPClient:        ... 20 more
[ERROR] :  TiHTTPClient:        Suppressed: javax.net.ssl.SSLHandshakeException: Handshake failed
[ERROR] :  TiHTTPClient:            ... 20 more
[ERROR] :  TiHTTPClient:        Caused by: javax.net.ssl.SSLProtocolException: SSL handshake terminated: ssl=0xaef13100: Failure in SSL library, usually a protocol error
[ERROR] :  TiHTTPClient: error:100c5410:SSL routines:ssl3_read_bytes:SSLV3_ALERT_HANDSHAKE_FAILURE (external/boringssl/src/ssl/s3_pkt.c:972 0x9defc240:0x00000001)
[ERROR] :  TiHTTPClient: error:100c009f:SSL routines:ssl3_get_server_hello:HANDSHAKE_FAILURE_ON_CLIENT_HELLO
[ERROR] :  TiHTTPClient:            at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
[ERROR] :  TiHTTPClient:            at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:324)
[ERROR] :  TiHTTPClient:            ... 19 more
[ERROR] :  TiHTTPClient:    Caused by: javax.net.ssl.SSLProtocolException: SSL handshake terminated: ssl=0xaef13100: Failure in SSL library, usually a protocol error
[ERROR] :  TiHTTPClient: error:100c5410:SSL routines:ssl3_read_bytes:SSLV3_ALERT_HANDSHAKE_FAILURE (external/boringssl/src/ssl/s3_pkt.c:972 0x9defc240:0x00000001)
[ERROR] :  TiHTTPClient: error:100c009f:SSL routines:ssl3_get_server_hello:HANDSHAKE_FAILURE_ON_CLIENT_HELLO (external/boringssl/src/ssl/s3_clnt.c:750 0xab1e350f:0x00000000)
[ERROR] :  TiHTTPClient:        at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
[ERROR] :  TiHTTPClient:        at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:324)
[ERROR] :  TiHTTPClient:        ... 19 more
[ERROR] :  TiHTTPClient: Caused by: javax.net.ssl.SSLProtocolException: SSL handshake terminated: ssl=0xaef13100: Failure in SSL library, usually a protocol error
[ERROR] :  TiHTTPClient: error:100c5410:SSL routines:ssl3_read_bytes:SSLV3_ALERT_HANDSHAKE_FAILURE (external/boringssl/src/ssl/s3_pkt.c:972 0x9defc240:0x00000001)
[ERROR] :  TiHTTPClient: error:100c009f:SSL routines:ssl3_get_server_hello:HANDSHAKE_FAILURE_ON_CLIENT_HELLO (external/boringssl/src/ssl/s3_clnt.c:750 0xab1e350f:0x00000000)
[ERROR] :  TiHTTPClient:    at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
[ERROR] :  TiHTTPClient:    at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:324)
[ERROR] :  TiHTTPClient:    ... 19 more

Any pointer is much appreciated. Thanks.

1

There are 1 answers

0
Arturo Mejia On

You should check if you have problems with your certificate You can find more info here http://developer.android.com/training/articles/security-ssl.html#UnknownCa

enter image description here