Monday, August 13, 2018

Import External Certificate into JDK truststore/Keystore

If you are getting SSLHandshakeException - unable to find valid certification path to requested target ,please follow below steps
In future many folks amongst us needs to import certificates for their respective web services
So Below are the steps to import the TSL/SSL certificate of third party

1. Open Commend prompt
2. Change path to security folder of your JDK which you are using in your project e.g. C:\Program Files\Java\jdk1.7.0_03\jre\lib\security>
3. Copy your certificates to security folder
4. Run below command to import certificate in your local truststore
keytool -importcert -alias <Alias> -file <Certificate_name.cer> -trustcacerts -keystore cacerts
e.g.
keytool -importcert -alias sagaralias -file pqr.cer -trustcacerts -keystore cacerts
5. It will ask for password and password is “changeit”
6. Certificate will get imported into your trust store and it will show you output.

Note:cacerts is the keystore provided by java.

No comments:

Post a Comment

How to check whether operating system is 64 bit or 32bit?

What is 32 and 64 bit operating system? The terms 32-bit and 64-bit refer to the way a computer's processor that is CPU, handles info...