How to update Java SSL Certificate



Update SSL certificates for third party application.


javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed Error?


Generally once in a year third party application certificates gets expired and can see exceptions like above. I have tried to cover few points while updating the certs.


Step 1: 
Identify which certificate has been expired or required to be updated.

Step 2:
Download certificates directly from the site, or get it from specific sources.
For example (Firefox browser), 
1) Go to third party site and click on "i" icon at the beginning of the URL. 
2) View More Info -> View Certificate Button ->  Check Period of Validity and expiry date. 
3) Go to Details Tab, and select site-domain or Certificate Hierarchy and click on Export button.
4) Save certificate (for ex. wwwgooglecom.crt) to local folder (tmp).



On windows machine:

Go to Installed Java path.

For ex. C:\Program Files\Java\jre1.8.0_121\bin>

Execute below command to import SSL.

keytool -import -alias <domain-name> -file /tmp/<domain-name>.crt

keytool -import -alias myabc.com -file /tmp/myabc.com.crt
keytool -import -alias myabc.com -file /tmp/myabc.com.cert


To Keystore:

C:\Program Files\Java\jre1.8.0_101\bin>keytool -import -alias mydomainname.com -file /tmp/mydomainname.com.crt -keystore "%JAVA_HOME%/jre/lib/security/cacerts"

Give password: changeit

On linux environment:

./keytool -import -alias <SERVER_NAME> -file /tmp/<SERVER_NAME>.cert -keystore /usr/java/jdk1.8.0_11/jre/lib/security/cacerts

or
./keytool -import -trustcacerts -alias SymantecxxxxxCA-G4 -file /tmp/SymantecxxxxxCA-G4.crt -keystore /usr/java/jdk1.8.0_12/jre/lib/security/cacerts




Comments

Popular posts from this blog

SVN plugin setup in IBM RAD8 - Checkout project from SVN

How to Upgrade Dojo in IBM WebSphere Portal v8.0

Dojo Enhanced Grid with Checkbox like radio button exmaple