Unfortunately Java's built-in cacerts
do not include StartCom SSL root certificates.
Because of this, you must tell java to trust these certificates.
The easiest way I've found to do it is as follows:
$ cp /usr/java/jdk1.7.0_25/jre/lib/security/cacerts ~
$ wget https://www.startssl.com/certs/ca.crt
$ wget https://www.startssl.com/certs/sub.class1.server.ca.crt
$ wget https://www.startssl.com/certs/sub.class2.server.ca.crt
$ wget https://www.startssl.com/certs/sub.class3.server.ca.crt
$ wget https://www.startssl.com/certs/sub.class4.server.ca.crt
The default password for the cacerts
store is changeit
.
$ keytool -import -storepass changeit -keystore cacerts -file ca.crt -alias startcomca
$ keytool -import -storepass changeit -keystore cacerts -file sub.class1.server.ca.crt -alias startcomclass1ca
$ keytool -import -storepass changeit -keystore cacerts -file sub.class2.server.ca.crt -alias startcomclass2ca
$ keytool -import -storepass changeit -keystore cacerts -file sub.class3.server.ca.crt -alias startcomclass3ca
$ keytool -import -storepass changeit -keystore cacerts -file sub.class4.server.ca.crt -alias startcomclass4ca
$ cp ~/cacerts src/main/resources/
In your code, load the trust store:
TrustStoreLoader.load("/cacerts", "changeit")
Thanks to http://stackoverflow.com/a/10077862/312322 for the sample code for loading a new trust store.