Friday, September 13, 2013

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

Problem Statement:-

While importing .pem format certificate in weblogic keystore using keytool command error was thrown as below
keytool error: java.lang.Exception: Input not an X.509 certificate



Background:-


I converted .p7b to .pem format using below command
openssl pkcs7 -print_certs -in ABC.p7b -inform der -out ABC.pem

and then tried importing it using keytool command 
keytool -importcert -alias ABC -file ABC.pem -keystore demoidentity.jks -storepass password

Cause:-

ABC.pem contains extra lines as highlighted below

subject=/serialNumber=6npr-psjxdqgGUW/7AUAFQC-27Xr/C=US/ST=California/L=Sunnyvale/O=ABC/CN=b2btest.abc.net
issuer=/C=US/O=GeoTrust, Inc./CN=GeoTrust SSL CA
-----BEGIN CERTIFICATE-----

Solution:-
Remove ALL the occurrence of highlighted line in the pem file and re-try.
 

 

No comments:

Post a Comment