« Return to Thread: how to ignore ssl certificate error

Re: how to ignore ssl certificate error

by Vinay Srini :: Rate this Message:

Reply to Author | View in Thread

You might want to take a look at:
http://juliusdavies.ca/commons-ssl/javadocs/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.html

The package is not a part of commons-httpclient, but a part of the
contrib packages.

Vinay

Milind W wrote:

> hi,
> I am trying to connect to a website that has a expired certificate. Instead
> of fixing this by importing the self signed certificate my prefered option
> is to  ignore the message progrmatically (similar to how a user does in  a
> browser). Is there a option I can set some where in htmlunit to do this?
> preferably at the page level.
>
> I found this thread which suggest how to do this for httpclient but my
> understanding we do not have direct access to httpclient in htmlunit.
> http://forum.java.sun.com/thread.jspa?threadID=411937&messageID=1886339
>
> Please help! This is a critical feature for me. At this rate hopefully I can
> cross the newbie stage pretty past :)
> Thanks
> -Milind
>
> Copy of my console.
>
> javax.net.ssl.SSLHandshakeException:
> sun.security.validator.ValidatorException: PKIX path building failed:
>
> sun.security.provider.certpath.SunCertPathBuilderException: unable to find
> valid certification path to requested target
> at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
> at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1520)
> at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:182)
> at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:176)
> at
> com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:975)
> at
> com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:123)
> at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:511)
> at
> com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:449)
> at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:817)
> at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1029)
> at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:621)
> at
> com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
> at
> org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
> at
>
> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1525)
> at
> org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
> at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
> at
> com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:126)
> at
> com.gargoylesoftware.htmlunit.util.DebuggingWebConnection.getResponse(DebuggingWebConnection.java:107)
> at
> com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1397)
> at
> com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1354)
> at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:330)
> at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:397)
> at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:384)
>
> Caused by: sun.security.validator.ValidatorException: PKIX path building
> failed: sun.security.provider.certpath.SunCertPathBuilderException: unable
> to find
>
> valid certification path to requested target
> at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:285)
> at
> sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191)
> at sun.security.validator.Validator.validate(Validator.java:218)
> at
> com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
> at
> com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
> at
> com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
> at
> com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:954)
> ... 27 more
> Caused by: sun.security.provider.certpath.SunCertPathBuilderException:
> unable to find valid certification path to requested target
> at
> sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
> at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
> at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280)
> ... 33 more
> -------------------------------------------------------
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Htmlunit-user mailing list
> Htmlunit-user@...
> https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>
>  

--
Why is it called "Windows"? "Gates" would be more appropriate...


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

 « Return to Thread: how to ignore ssl certificate error