hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ray Williams Robinson Valiente" <shaka.shad...@gmail.com>
Subject Re: SSL certificates with HttpClient 4.3.1...
Date Mon, 11 Nov 2013 22:58:27 GMT
That worked very well. Thanks a lot.

> 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
>
>
>


-- 
Eng. Ray Williams Robinson Valiente
Base Technologies Group
DESOFT, Havana Division
Phone: (+537)8356362


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message