keytool error: java.lang.Exception: Input not an X.509 certificate

dbbooh01 picture dbbooh01 · Aug 10, 2010 · Viewed 30k times · Source

I am trying to import Gmails smtp certificate for use with Jira, but I get this error when importing using Javas keytool.

I used openssl to get the certificate, everything between ----Begin Certificate---- and ----End Certificate---- (inclusive). I also attempted to create an x.509 certificate using Windows Certificate Manager, but still get this error. I have verified that there are no extra whitespaces in the file.

I have seen many people with this problem online, but none of the solutions seem to work for me. Any help would be appreciated.

Thanks

Answer

Borealid picture Borealid · Aug 10, 2010

openssl x509 -outform der -in foo.pem -out foo.der

Then use the DER-encoded output certificate.