how to ignore ssl certificate error

View: New views
8 Messages — Rating Filter:   Alert me  

how to ignore ssl certificate error

by Milind W :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: how to ignore ssl certificate error

by Vinay Srini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: how to ignore ssl certificate error

by Milind W :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This does not really help me to get htmlunit to ignore the ssl error, or am
I missing something?


>From: Vinay Srini <vsrini@...>
>Reply-To: htmlunit-user@...
>To: htmlunit-user@...
>Subject: Re: [Htmlunit-user] how to ignore ssl certificate error
>Date: Wed, 10 Oct 2007 13:27:06 -0700
>
>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



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

Parent Message unknown Re: how to ignore ssl certificate error

by Ahmed Ashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I believe you should try:
 
Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
Protocol.registerProtocol("https", easyhttps);
1- Put it before you call any HtmlUnit stuff.
2- It doesn't depend on your HttpClient code usage, it just registers the protocol at static level.

This was successful for me some time ago.
 
Many thanks,
Ahmed
----- Original Message ----
From: Milind W <ycol@...>
To: htmlunit-user@...
Sent: Thursday, October 11, 2007 12:12:50 AM
Subject: Re: [Htmlunit-user] how to ignore ssl certificate error

This does not really help me to get htmlunit to ignore the ssl error, or am
I missing something?


>From: Vinay Srini <vsrini@...>
>Reply-To: htmlunit-user@...
>To: htmlunit-user@...
>Subject: Re: [Htmlunit-user] how to ignore ssl certificate error
>Date: Wed, 10 Oct 2007 13:27:06 -0700
>
>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



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



Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & 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

Re: how to ignore ssl certificate error

by Milind W :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi Ahmed,
Looks like I need a commons-httpclient contrib jar which seems to be
available nowhere. Can somone send me one, with no warranties :)  if you
have build one. I just want to be able to use htmlunit with sites that have
expired certificates without having to figure out how to build
commons-httpclient contrib (if I can get away with that).
Thanks
-Milind

>From: Ahmed Ashour <asashour@...>
>Reply-To: htmlunit-user@...
>To: htmlunit-user@...
>Subject: Re: [Htmlunit-user] how to ignore ssl certificate error
>Date: Thu, 11 Oct 2007 00:31:50 -0700 (PDT)
>
>I believe you should try:
>
>Protocol easyhttps = new Protocol("https", new
>EasySSLProtocolSocketFactory(), 443);
>Protocol.registerProtocol("https", easyhttps);
>
>1- Put it before you call any HtmlUnit stuff.
>2- It doesn't depend on your HttpClient code usage, it just registers the
>protocol at static level.
>
>This was successful for me some time ago.
>
>Many thanks,
>Ahmed
>
>----- Original Message ----
>From: Milind W <ycol@...>
>To: htmlunit-user@...
>Sent: Thursday, October 11, 2007 12:12:50 AM
>Subject: Re: [Htmlunit-user] how to ignore ssl certificate error
>
>
>This does not really help me to get htmlunit to ignore the ssl error, or am
>I missing something?
>
>
> >From: Vinay Srini <vsrini@...>
> >Reply-To: htmlunit-user@...
> >To: htmlunit-user@...
> >Subject: Re: [Htmlunit-user] how to ignore ssl certificate error
> >Date: Wed, 10 Oct 2007 13:27:06 -0700
> >
> >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
>
>
>
>-------------------------------------------------------------------------
>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
>
>
>      
>____________________________________________________________________________________
>Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get
>listings, and more!
>http://tv.yahoo.com/collections/3658


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



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

Parent Message unknown Re: how to ignore ssl certificate error

by Ahmed Ashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I believe there is no already built jar, but if you go to:
 
there is a link to:
 
 
From which you can get the source of two .java, then compile yourself.
 
Many thanks,
Ahmed


Moody friends. Drama queens. Your life? Nope! - their life, your story.
Play Sims Stories at Yahoo! Games.
-------------------------------------------------------------------------
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

Re: how to ignore ssl certificate error

by Milind W :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Ahmed that worked like a charm.

For future reference if someone wants to do the same thing its fairly
straight forward.

1)Create a package called
org.apache.commons.httpclient.contrib.ssl
add the two files.
EasySSLProtocolSocketFactory.java
EasyX509TrustManager.java
Compile.

2)Add the following lines of code to your htmlclient before making any
htmlunit calls

Protocol easyhttps = new Protocol("https", new
EasySSLProtocolSocketFactory(), 443);
Protocol.registerProtocol("https", easyhttps);

-Milind

>From: Ahmed Ashour <asashour@...>
>Reply-To: htmlunit-user@...
>To: htmlunit-user@...
>Subject: Re: [Htmlunit-user] how to ignore ssl certificate error
>Date: Thu, 11 Oct 2007 12:24:59 -0700 (PDT)
>
>I believe there is no already built jar, but if you go to:
>http://jakarta.apache.org/httpcomponents/httpclient-3.x/sslguide.html
>
>there is a link to:
>
>http://svn.apache.org/viewvc/jakarta/httpcomponents/oac.hc3x/trunk/src/contrib/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java?view=markup
>
>From which you can get the source of two .java, then compile yourself.
>
>Many thanks,
>Ahmed
>
>
>
>____________________________________________________________________________________
>Be a better Heartthrob. Get better relationship answers from someone who
>knows. Yahoo! Answers - Check it out.
>http://answers.yahoo.com/dir/?link=list&sid=396545433


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



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

Re: how to ignore ssl certificate error

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

FYI, starting with version 1.14 you can use WebClient.setUseInsecureSSL(true) instead, and it will take care of all the HttpClient configuration behind the scenes.