Keytool Error: Java. Lang. Exception: Public Keys in Reply and Keystore Don't Match

Keytool Error: Java. Lang. Exception: Public Keys in Reply and Keystore Don't Match

This is about how to import a SSL Certificate provided vendor to Tomcat Web Server.

Note: The CSR generated on Network balancer and the certificate is generated based on the provided CSR.

Can someone help me with the steps to how to import the certificate (.cer) to the tomcat server.

as i said the csr is generated on loadbalancer , I think it is conflicting. How to make the cert work and Import on tomcat?

1

1 Answer

  1. Firstly, using keytool utility have exported the private key

    keytool -v -importkeystore -srckeystore keystorefile.jks -srcalias alias -destkeystore exportedfilefile.p12 -deststoretype PKCS12
    
    openssl pkcs12 -in exportedfilefile.p12 -nocerts -nodes
    
  2. Secondly using open ssl , exported the .pfx file using the privatekey and .cert (servercertificate).

    openssl pkcs12 -export -out exportedfilename.pfx -inkey  privatekey -in servercertificate.crt
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.