java 主动信任证书
SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, mid.toCharArray()).loadTrustMaterial(keyStore, new TrustStrategy() {
// 信任所有
public boolean isTrusted(java.security.cert.X509Certificate[] chain, String authType) {
return true;
}
}).build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, new String[] { "TLSv1" },
null, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
标签:keyStore,sslcontext,java,String,证书,SSLConnectionSocketFactory,new,信任
来源: https://www.cnblogs.com/xiluhua/p/11763551.html