On Mon, 2013-11-11 at 12:48 -0500, Ray Williams Robinson Valiente wrote:
> Hi:
> 
> I understand how risky this could be but, is there some way to simply
> trust in any SSL certificate when using HttpClient 4.3.1 over https URLs,
> without including deprecated classes/functionalities? I working on some
> sort of spider Java program and I certainly need to accept all SSL
> certificates, no matter they nature.
> 

Try this

---
SSLContext sslcontext = SSLContexts.custom()
        .loadTrustMaterial(null, new TrustStrategy() {
            @Override
            public boolean isTrusted(
                    final X509Certificate[] chain, 
                    final String authType) throws CertificateException {
                return true;
            }
        }).build();
CloseableHttpClient client = HttpClients.custom()
        .setSslcontext(sslcontext)
        .build();
---

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to