Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I realize that there are multiple posts about converting .cer to .pem, but none actually mention issues regarding the coversion. I have a cert named Cert.cer (original, I know) that I'm trying to convert to Cert_PEM.pem using the following command:

openssl x509 -inform der -in Cert.cer -out Cert_PEM.pem

In doing so I run into this error:

13892:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1316:
13892:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:380:Type=X509

I have some knowledge of certs, SSL and encryption, but this goes beyond the current scope of it.

EDIT: Here are the first 4 lines of the cert:


Any help would be excellent!

share|improve this question
Please provide the first few lines of the .cer file, it may not be in the format you expect. – mgorven Jan 9 '13 at 0:52
up vote 1 down vote accepted

What you have is a PEM-encoded .cer file. Converting may be as easy as changing the file extension. SSL-file formats are legion and der-encoding is actually not that common.

A general rule of thumb is:

  • If looks like base64 encoding, it's probably PEM-encoded.
  • If it looks like cat-ing a binary file, it's probably DER-encoded.
share|improve this answer
I was thinking it was something like that... But I didn't want to be the guy asking if changing the file extension would work. I guess this is another one of those "The only stupid question is the one unasked" moments. – Joshua Jan 9 '13 at 17:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.