Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 have zero knowledge on certificates . I searched on internet and found few , but none of them helped me in my case.

I am on Red Hat Enterprise Linux ES release 4 (Nahant Update 9)

I am trying to convert .cer ( this is a CAS certificate) to .pem and getting the below error

openssl x509 -inform der -in cas.cer -out cas.pem
unable to load certificate
4419:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:959:
4419:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:304:Type=X509

I am able to read the plain text of it just by running

[root@sls32 install]# openssl x509 -in cas.cer -text -noout
        Version: 3 (0x2)
        Serial Number: 1331657215 (0x4f5f79ff)
        Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=USA, ST=PA, L=KOP, O=TEST, OU=TEST,
            Not Before: Mar 13 16:46:55 2012 GMT
            Not After : Dec 27 16:46:55 2016 GMT
        Subject: C=USA, ST=PA, L=Malvern, O=TEST, OU=TEST,                                                                                                             m
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (1024 bit)
                Modulus (1024 bit):
                Exponent: 65537 (0x10001)
    Signature Algorithm: sha1WithRSAEncryption

Could any body give me the correct command for it ?

Thank You

share|improve this question
up vote 7 down vote accepted

Actually, the .cer and .pem extensions are quite confusing for me. From the command output provided, I think your cas.cer should be bas64 encoded, which is the format accepted by OpenSSL without any additional parameter.

So, you may try to copy the cas.cer to cas.pem (no conversion is needed, just change the filename).

share|improve this answer
Thank You that helped me – Bujji Nov 9 '12 at 19:00

I've used this site in the past to convert a cert with good results.

share|improve this answer
Thanks You Danbig . I got the mentioned command from there only .. so some thing I am missing looks like – Bujji Nov 9 '12 at 18:38
Did you use their online tool to try and convert it? – DanBig Nov 9 '12 at 18:40
Thank You . Yes I tried that too .I gave "Type of Current Certificate" as DER and convert as 'PEM' . Got error saying "There was a problem converting that certificate. It may be corrupt or it may be in a different format than the one you selected. You can try using a different format or running the OpenSSL commands on your own machine. The private key also may not match the certificate that you uploaded." – Bujji Nov 9 '12 at 18:43
Does it have a private key? You won't be able to convert without one. – DanBig Nov 9 '12 at 18:51
Thank You DanBig fr your help . Just renaming the file helped . I spent almost a day for this . Thanks again – Bujji Nov 9 '12 at 19:00

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.