且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android自签名证书:找不到证书路径的信任锚

更新时间:2021-09-07 21:48:12

在您的代码中,您正在创建和初始化SSLContext,但没有使用它.也许您应该替换:

In your code your are creating and initializing a SSLContext but not using it. Maybe you should replace :

urlConnection.setSSLSocketFactory(CertificateManager.getInstance().getSslContext().getSocketFactory());

作者

urlConnection.setSSLSocketFactory(sslContext.getSocketFactory());

我还建议您尽可能将选项-Djavax.net.debug=all传递给JVM.它将在标准输出上打印有关SSL连接和握手的详细信息.

I also suggest you if possible to pass the option -Djavax.net.debug=all to the JVM. It will print detailed information about the SSL connection and handshake on the standard output.