This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other JSE/JEE APIs and the fly likes Default keystore(s) used for HTTPS? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Default keystore(s) used for HTTPS?" Watch "Default keystore(s) used for HTTPS?" New topic
Author

Default keystore(s) used for HTTPS?

David Norman
Greenhorn

Joined: May 15, 2008
Posts: 2
I'm trying to do a get over https to one of our servers. It works from a browser, but not from my Java code (running on Java version 1.5.0), where I get the exception:

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

(I can connect to other urls using https.)

As I understand it, the error is occurring because I don't have a certificate from the CA that signed the server certificate. So I've exported the CA root certificate from Internet Explorer and imported it into the keystore of my jre using keytool.

However, I still get the same exception and I'm wondering if the SSL library and I are using the same keystore.

The keystore I imported the certificate into is lib\security\cacerts relative to the jre path from the java.home property.

Whether I set javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword or not makes no difference. I understand there is search algorithm that uses the javax.net.ssl.trustStore property but will ultimately use lib\security\cacerts.

Can anyone see any mistakes in my reasoning or alternatives I could try? I guess I could put the CA certificate in a separate keystore and specify that via javax.net.ssl.trustStore...

My actual code is just this:



Thanks,

David
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
Did you find a solution? I've got this exact same issue. I'm using a Mac.


Experience and talent are independent of age
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Default keystore(s) used for HTTPS?