you are getting below exception?

" unable to find valid certification path to requested target
" or
" Trying to open an SSL connection to a host using JSSE / JAVA"

Then, Go through this post...

............................................................................................................................................

When this comes into picture?


when trying to open an SSL connection to a host using JSSE. What this usually means is that the server is using a test certificate (possibly generated using keytool) rather than a certificate from a well known commercial Certification Authority such as Verisign or GoDaddy. Web browsers display warning dialogs in this case, but since JSSE cannot assume an interactive user is present it just throws an exception by default.

............................................................................................................................................

Manual Process:


1) Open the https website in any browser (say, Internet Explorer 8), whose certificate is needed.
2) You will find a LOCK symbol beside address bar. Click it.
3) Select View Certificate options.
4) This pops out a certificate window with 3 tabs (General, Details, Certification path).
5) Goto Details tab and click Copy to file and then next, next, next.... select path and finish
6) Certificate .cer of that site you are accessing is exported to ur PC.
7) Goto command prompt and set its path to your . cer that we exported in above step.
8) Import your .cer file into keystore using following command.
keytool -import -alias somename -file our_cer_file_name.cer -keystore keystore_name

you have successfully imported certificate of https site that you are accessing.

9) Now you can check its presence in key store using following command:
keytool -list -keystore keystore_name

Note: listing command works when you are in the path where you keystor is present. Generally default keystore of java is available in you jdk/lib/security folder with name cacerts.
in my PC it is in C:\Program Files\Java\jdk1.6.0_16\jre\lib\security

............................................................................................................................................

Automatic Process:
( It can be done in two ways. Through GUI or Command Prompt.)

Steps for GUI way of importing certificate:

1) Open the https website in any browser (say, Internet Explorer 8), whose certificate is needed.
2) You will find a LOCK symbol beside address bar. Click it.
3) Select View Certificate options.
4) This pops out a certificate window with 3 tabs (General, Details, Certification path).
5) Goto General tab and click Install Certificate and then next then select Keystore and finish.
you have successfully imported certificate of https site that you are accessing.
............................................................................................................................................

Steps for Command Prompt way of importing certificate:

1) copy java code of InstallCert which I found it in Andreas Sterbenz`s Former
http://blogs.sun.com/andreas/entry/no_more_unable_to_find
2) Compile it java InstallCert ecc.fedora.redhat.com from command prompt and follow steps given in above link.

you have successfully imported certificate of https site that you are accessing.

Comments (0)