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

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
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1331657215 (0x4f5f79ff)
        Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=USA, ST=PA, L=KOP, O=TEST, OU=TEST, CN=TEST.com
        Validity
            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, CN=TEST.co                                                                                                             m
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (1024 bit)
                Modulus (1024 bit):
                    00:9d:af:d0:c9:ce:8f:50:88:72:46:34:d3:b3:80:
                    e2:07:61:21:10:1f:b2:81:ce:7f:ad:0b:d3:5c:d3:
                    67:33:b1:20:e7:fc:8b:aa:5e:5a:e5:22:1e:91:c3:
                    e9:29:7e:d0:ea:ec:32:35:b1:b9:b6:d7:ca:e7:7a:
                    21:c3:91:99:fa:14:61:b5:20:31:40:28:cb:93:07:
                    04:dd:dc:56:f0:1e:ac:dd:11:8a:86:db:27:66:e7:
                    31:3f:81:50:17:8c:3d:3a:c5:92:ed:f8:52:e7:cc:
                    44:66:1d:9f:96:a4:1b:9b:ad:13:6a:e3:9c:dc:b8:
                    fb:81:28:76:cd:f7:a5:9d:f7
                Exponent: 65537 (0x10001)
    Signature Algorithm: sha1WithRSAEncryption
        28:68:a0:0b:f1:cc:20:b2:d9:69:a5:1b:4b:fc:83:ad:f8:4d:
        2a:cf:2e:7f:10:7c:60:d0:9b:63:2c:54:be:df:15:32:c7:56:
        b8:56:45:a8:62:af:77:25:b7:17:b0:ef:3f:b9:41:d0:17:90:
        8c:b9:a3:8b:bd:d2:72:89:4f:85:d5:96:c4:7b:9a:e5:ec:89:
        3d:16:c5:9c:70:91:13:79:8b:ef:1d:d0:88:eb:e4:23:e2:6c:
        79:68:bf:69:30:c9:9c:98:d8:1e:a5:b8:b6:ed:07:32:88:c6:
        6e:f2:69:d2:f9:06:22:7a:9a:cd:92:1e:3b:b1:4c:7b:14:4a:
        69:48

Could any body give me the correct command for it ?

Thank You

share|improve this question

2 Answers 2

up vote 2 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.

https://www.sslshopper.com/ssl-converter.html

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

 
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.