hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy <guy.van.tilbo...@gmail.com>
Subject javax.net.ssl.SSLHandshakeException as a result of new GetMethod("/") ?
Date Thu, 24 Aug 2006 12:08:02 GMT
Hi all,

i have written an application that checks https connections. I use the
HTTPClient 3.0.1 as described in the SSL guide

Protocol myhttps = new Protocol("https", new MySSLSocketFactory(), 443);

HttpClient httpclient = new HttpClient();
httpclient.getHostConfiguration().setHost(myHost, myPort, myhttps);
GetMethod httpget = new GetMethod(myObject);
try {
  httpclient.executeMethod(httpget);

  byte[] repsonse = getResponseBody();

  System.out.println(httpget.getStatusLine());
} finally {
  httpget.releaseConnection();
}

i have two versions of the MySSLSocketFactory: one that does not use a
truststore (accepting any certificate) and one that does.

i have the following parameters to set:

myHost, myPort, truststore (used to determine which version of the
MySSLSocketFactory to use), truststorepassword and myObject.

In the case i set myObject to "/" i get no exception, in case i set
myObject to "/index.html" i get the following exception:

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

The code works fine for other hosts and the result does not change
when using the other version of MySSLSocketFactory: the value of
myObject determines the exception (if the host experiences this
problem)


I am stunned because the certificates are valid and are in the
truststore (if they are used)

Any suggestion or help would be appreciated

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message