During the import of an SSL certificate you may get the following error: Error: "java.lang.Exception: Input not an X.509 certificate."

keytool -import -trustcacerts -alias 'alias' -file certificate.crt [.p7b, .cer] -keystore 'your keystore'.jks

To eliminate this error we recommend:

  • make sure that the SSL certificate has the recommended format; check and import the certificate
  • the SSL certificate alias will have to be imported using -alias. To verify the alias run: -list -keystore 'your keystore'.jks -v; after you have identified the correct alias, try to re-import the file
  • check the name in the keystore; before importing, make sure the data is correct
Was this answer helpful? 0 Users Found This Useful (1 Votes)