为X509TrustManager实现checkServerTrusted方法的推荐方式是什么?我需要使用reimplement this来进行ssl锁定,但是我总是可以看到这个实现:
public void checkServerTrusted(X509Certificate[] certificates, String authType)
throws CertificateException {
if ((certificates != null) && (certificates.length == 1)) {
certificates[0].checkValidity();
} else {
standardTrustManager.checkServerTrusted(certificates, authType);
}
}取自此response。然而,在我看来,这似乎是错误的。它只检查证书是否有效(未过期),不检查其他。
你有什么可以推荐给我的实现吗?
发布于 2017-07-10 17:39:15
好的,解决方案不是使用自定义的TrustManagers,而是使用我的固定SSL证书初始化KeyStore。
https://stackoverflow.com/questions/45008122
复制相似问题