且构网

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

如何忽略PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException?

更新时间:2021-12-12 02:52:59

如果你想一起忽略证书,此处:使用Jersey客户端忽略自签名SSL证书

If you want to ignore the certificate all together then take a look at the answer here: Ignore self-signed ssl cert using Jersey Client

虽然这会使您的应用程式容易受到中间人攻击。

Although this will make your app vulnerable to man-in-the-middle attacks.

该证书作为您的java存储作为可信证书。
本网站可能是有帮助的。
http:// blog。 icodejava.com/tag/get-public-key-of-ssl-certificate-in-java/

Or, try adding the cert to your java store as a trusted cert. This site may be helpful. http://blog.icodejava.com/tag/get-public-key-of-ssl-certificate-in-java/

这是另一个线程,显示如何添加证书到您的商店。
Java SSL连接,以编程方式将服务器证书添加到密钥库

Here's another thread showing how to add a cert to your store. Java SSL connect, add server cert to keystore programatically

关键是:

KeyStore.Entry newEntry = new KeyStore.TrustedCertificateEntry(someCert);
ks.setEntry("someAlias", newEntry, null);