0

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!

Joshua
  • 179
  • 1
  • 3
  • 12
  • 1
    Please provide the first few lines of the `.cer` file, it may not be in the format you expect. – mgorven Jan 09 '13 at 00:52

1 Answers1

1

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.
sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
  • 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 09 '13 at 17:49