keytool error: java.security.cert.CertificateParsingException: invalid DER-encoded certificate data

  Print
When trying to import your certificate to Glassfish or Java keystore you receive the error:

keytool error: java.security.cert.CertificateParsingException: invalid DER-encoded certificate data


This can occur if the certificate format you are importing is incorrect. The certificate supplied by the Certificate Authorities is normally in a PEM format. Glassfish requires DER format to import.

You can achieve this using OpenSSL. (Mac OSX includes OpenSSL within Terminal.app) and the following command

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


Related Articles

Login