I have a public certificate from a CA. I want to create a Java SSL connection using this certificate. I referred How can I use different certificates on specific connections? and Java SSL connection with self-signed certificate without copying complete keystore to client. From this I understand that I need to import the certificate into a keystore. However I haven't received any keystore from the CA. I created a keystore and tried to import the public certificate to it. But then I get the following error:
keytool error: java.lang.Exception: Public keys in reply and keystore don't match
Do i need a keystore from the CA or am i doing something wrong?
Command used to create the keystore:
keytool -genkey -alias tomcat -keyalg RSA -keystore keystore.jks
Command used to import the cert:
keytool -import -v -alias tomcat -file signed-cert.pem -keystore keystore.jks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…