For the benefit of anyone getting a “java.lang.Exception: Input not an X.509 certificate” when trying to import a signed certificate using keytool:
I was trying to import the certificate that Thawte signed for me into the Java based keystore. Currently my best guess is that keytool was written by an intern with way not enough coffee in his/her body. This is what I did first:
keytool -import -keystore keystore.production -storepass pinky -file thawte.crt
The error returned to me was:
keytool error: java.lang.Exception: Input not an X.509 certificate
Right. I know its not. So what?
This error message wasted a possible precious 20 minutes of my life. To save someone some time, it turns out I forgot to specify the key alias! Very obvious from the exception, I know. This is correct:
keytool -import -keystore keystore.production -storepass pinky -file thawte.crt -alias key-alias-in-store

1 response so far ↓
1 J H // Mar 26, 2008 at 7:16 pm
I have also found that if there is space at the end of the Base-64 encoded data it will cause the same problem.
Leave a Comment