2

我正在使用 Ion,但是当我尝试将它与 Https 一起使用时,它给了我一个例外。

代码:

Ion.with(getApplicationContext())
    .load(mBaseUrl + "Token")
    .setJsonObjectBody(json)
    (...)

例外:

09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ javax.net.ssl.SSLHandshakeException: Handshake failed
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.google.android.gms.org.conscrypt.OpenSSLEngineImpl.unwrap(SourceFile:421)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:383)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.koushikdutta.async.AsyncSSLSocketWrapper$4.onDataAvailable(AsyncSSLSocketWrapper.java:172)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.koushikdutta.async.BufferedDataEmitter.onDataAvailable(BufferedDataEmitter.java:33)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.koushikdutta.async.BufferedDataEmitter.onDataAvailable(BufferedDataEmitter.java:61)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.koushikdutta.async.Util.emitAllData(Util.java:20)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.koushikdutta.async.AsyncNetworkSocket.onReadable(AsyncNetworkSocket.java:175)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:766)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.koushikdutta.async.AsyncServer.run(AsyncServer.java:608)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.koushikdutta.async.AsyncServer.access$700(AsyncServer.java:37)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.koushikdutta.async.AsyncServer$13.run(AsyncServer.java:557)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:282)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:192)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.google.android.gms.org.conscrypt.Platform.checkServerTrusted(SourceFile:158)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.google.android.gms.org.conscrypt.OpenSSLEngineImpl.verifyCertificateChain(SourceFile:629)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake_bio(Native Method)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ at com.google.android.gms.org.conscrypt.OpenSSLEngineImpl.unwrap(SourceFile:411)
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ ... 10 more
09-24 11:53:00.211  17654-17940/com.gfi.connectelu W/System.err﹕ Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
4

2 回答 2

1

最近报告了一个关于 Ion 上的SSL 握手的问题:

同时,您也许可以看看Ion:添加对自签名证书的支持

于 2014-11-03T09:20:09.317 回答
0

您正在与证书错误的服务器交谈。如果它是自签名证书,则需要将其安装在 ion 的 http 客户端中。

java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
于 2015-02-20T23:44:57.847 回答