Programmers learn & share
0 votes

Problem :

I am getting bellow error while using keytool

keytool error: java.lang.exception: public keys in reply and keystore don't match

by (6.9k points)  
edited by | 86 views

1 Answer

0 votes


The three certificates that we need to look at are probably:

  1. The SSL cert of the web service
  2. The CA cert that signed by the SSL cert
  3. The root cert that signed the CA

now you need  to add a trust anchor to your truststore by default: ${JAVA_HOME}/jre/lib/security/cacerts), with this result your client accepts the SSL certificate of the webservice.

Now you need to add the root certificate to your truststore:

keytool -import -keystore ${JAVA_HOME}/jre/lib/security/cacerts -file CCA_Certificate.cer -alias theCCARoot

Further Readings:

by (36.1k points)  
edited by
2,228 questions
2,738 answers
241 users