Importing Certificate into cacerts of JRE


Importing Certificate into cacerts of JRE will solve javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed issue. This can be done using Keytool in java.

Below steps needs to be done for importing untrusted or new trust certificate into java.

Export the certificate from browser and save in some path. E.g. vtm.cer. Go to command prompt [inside JRE bin folder], type the below command.

 

keytool -list -keystore ..\lib\security\cacerts

 

Next step is to add the certificate file exported from browser to cacerts. For doing this, run the below command in cmd.

 

keytool -import -alias myprivateroot -keystore ..\lib\security\cacerts -file D:\Work\vtm\certificate_ssl\vtm.cer

 

After doing that, keytool will display certificate contents with fingerprint details and it asks to whether to “Trust this certificate or not”. Giving YES will add the certificate to cacerts file.


About vtm

Well done is better than Well Said!!! Web Enthusiast, Blogger, Open source contributor!!! And Web/Software Consultant for Personal and Business

Leave a comment

Your email address will not be published. Required fields are marked *

eighteen − 6 =