I had a similar problem when I tried to import a .crt file into java keystore.
I can fix this by following these steps:
Create a pkcs12 format keystore:
Enter the password as you want in two commands:
openssl pkcs12 -export -name <domain_name> -in <certificate_name>.crt -inkey <certificate_name>.key -out keystore.p12
Convert pkcs12 keystore to java keystore
keytool -importkeystore -destkeystore tomcat.jks -srckeystore keystore.p12 -srcstoretype pkcs12 -alias <domain_name>
Verify your certificate in the keystore:
keytool -list -v -keystore tomcat.jks
Pritish shah
source share