[MOD-2209] Android : Appcelerator HTTPS Module throwing error
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2016-10-31T17:50:59.000+0000 |
Affected Version/s | Release 5.2.0, Release 5.1.2 |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Aminul Islam |
Assignee | Gary Mathews |
Created | 2016-03-07T18:47:25.000+0000 |
Updated | 2018-08-06T17:41:07.000+0000 |
Description
Hi,
when we run our app with "Appcelerator HTTPS Module" in Android (Android 5.0.2) throwing errors.
Error Log :
[ERROR] : TiHTTPClient: (TiHttpClient-2) [11862,19699] HTTP Error (javax.net.ssl.SSLHandshakeException): Leaf certificate could not be verified with provided public key
[ERROR] : TiHTTPClient: javax.net.ssl.SSLHandshakeException: Leaf certificate could not be verified with provided public key
[ERROR] : TiHTTPClient: at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:322)
[ERROR] : TiHTTPClient: at com.android.okhttp.Connection.upgradeToTls(Connection.java:1257)
[ERROR] : TiHTTPClient: at com.android.okhttp.Connection.connect(Connection.java:1188)
[ERROR] : TiHTTPClient: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:395)
[ERROR] : TiHTTPClient: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:298)
[ERROR] : TiHTTPClient: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:399)
[ERROR] : TiHTTPClient: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:349)
[ERROR] : TiHTTPClient: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:165)
[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.http.DelegatingHttpsURLConnection.getContentLength(DelegatingHttpsURLConnection.java:146)
[ERROR] : TiHTTPClient: at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getContentLength(HttpsURLConnectionImpl.java:25)
[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: at appcelerator.https.PinningTrustManager.checkServerTrusted(PinningTrustManager.java:84)
[ERROR] : TiHTTPClient: at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:116)
[ERROR] : TiHTTPClient: at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:550)
[ERROR] : TiHTTPClient: at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
[ERROR] : TiHTTPClient: at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:318)
Attachments
File | Date | Size |
---|---|---|
downloader.js | 2016-05-26T04:23:37.000+0000 | 5851 |
Hi is there code to reproduce this?
Hi, Please use example code in module folder. You can also use sample code from appcelerator documentation. Thanks
[~aislam] Can you test it with another website/link that uses another certificate(der)? The error ur getting is the authentication failing. Would other links and cert work? If it's throwing an error, it could be that the certificate does not match any more. Which is how it's suppose to work and it's function.
Upon further investigation, I find no issues with this ticket. First you need to check that the certificate is correct with one of the following commands:- {quote} openssl x509 -in certificatefile.cer -noout -text openssl x509 -inform pem -in certificatefile.cer -noout -text openssl x509 -inform der -in certificatefile.cer -noout -text {quote} From here, you can look into the certificate to ensure it's the correct certificate. Ensure that the validity is correct and it is for the correct website. Once that's done you can continue as mentioned in the demo code. Demo code as follows:-
Note: If the certificate is no longer valid, it WILL throw an error. Please use a valid certificate. To inspect the certificate, use the commands mentioned earlier in this comment. A GeoTrust cert will work.
If there are no more issues, will be resolving this ticket.
[~rmitro] Any updates on your end?
I'm gonna resolve this ticket as there are no updates.
Closing as a duplicate. If this is in error, please reopen.