I have to access a webservice hosted at port 443.Service provider has shared three certificate with us.
I have to add them to keystore by creating a form chain for the SSL communication.I have followed below steps.
keytool -keystore npci_keystore_test.jks -genkey -alias npci_client_testore
Result :- keystore npci_keystore_test.jks created.
keytool -import -keystore npci_keystore_test.jks -file CA_Certificate.cer -alias theCARoot
Result :- certificate CA_Certificate.cer is added to keystore.
keytool -import -keystore npci_keystore_test.jks -file CCA_Certificate.cer -alias theCCARoot
Result :- certificate CCA_Certificate.cer is added to keystore.
keytool -import -keystore npci_keystore_test.jks -file ABCD.cer -alias npci_client_testore
At the step 4 i have below exception
Enter keystore password: (and when i enter password i have below exception)
keytool error: java.lang.Exception: Public keys in reply and keystore don't match
I have already done search in SO,but so far no luck.
I am following below source to create the store and import certificate in it. JKS Keystore
EDIT:---
I have tested it by changing the import order of certificate,but no luck so far.
The issue here is the alias you used while importing the certificate which is similar to the one you used while creating the JKS store. Just change the alias and it will solve your issue. The source document [1] needs to be corrected accordingly.
[1] http://docs.oracle.com/cd/E19509-01/820-3503/ggfgo/index.html