Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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:

-----BEGIN CERTIFICATE-----
MIIC6DCCAdACAQMwDQYJKoZIhvcNAQEFBQAwgYQxCzAJBgNVBAYTAlVTMQ4wDAYD
VQQIEwVUZXhhczEPMA0GA1UEBxMGQXVzdGluMS4wLAYDVQQLEyVNb3RpdmUgU2Vy
dmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MQ8wDQYDVQQKEwZNb3RpdmUxEzAR

Any help would be excellent!

share|improve this question
1  
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

1 Answer 1

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

 
discard

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.