Wednesday, June 20, 2012

Trouble Converting Certificate from DER to PEM

I got my certificate in der format (at least I thought it was), because of the extension : cer.

Removed the windows carriage returns using dos2unix (via cygwin)

When I did :

openssl x509 -inform DER -outform PEM -in mycert.cer -out cacerts.pem

I got these errors:


unable to load certificate
6932:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:.\crypto\as
n1\tasn_dec.c:1319:
6932:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:.\
crypto\asn1\tasn_dec.c:381:Type=X509

Turns out my file was already a pem, so I just renamed the extension.

This was also the case for a crt file I was trying to convert.

I just appended it to the end of my new pem file.

cat mycert2.crt >> cacerts.pem


No comments:

Post a Comment