Sunday, June 21, 2015

How to add a certificate to a JRE truststore

Exception in log:
Message               : Failed to route event via endpoint:
--------------------------------------------------------------------------------
Exception stack is:
1. unable to find valid certification path to requested target (sun.security.provider.certpath.SunCertPathBuilderException)
  sun.security.provider.certpath.SunCertPathBuilder:196 (null)

On the server, I listed the jre trusted ca certs
/opt/jdk1.7.0_67/bin/keytool -list -v -keystore /opt/jdk1.7.0_67/jre/lib/security/cacerts
, which showed that the COMODO RSA Certification Authority was not present.  This certificate was present CN=AAA Certificate Services, O=Comodo CA Limited, L=Salford, ST=Greater Manchester, C=GB, however this is not on the cert chain of the ABC.com site.

I installed it to the jre truststore:
/opt/jdk1.7.0_67/bin/keytool -import -trustcacerts -file comodorsaaddtrustca.crt -alias comodorsaca -keystore /opt/jdk1.7.0_67/jre/lib/security/cacerts

NB. the default truststore password is changeit
(See most-common-java-keytool-keystore-commands for useful ssl commands)