8

I am trying to install SSL certificate from a certificate authority into my httpd server in CentOS 5.x. When I configure it and start the server I am getting the following errors,

[error]Init: Unable to read server certificate from file /etc/pki/tls/certs/ssl_certificate.crt
[error] SSL Library Error: 218570875 error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long

I am following the procedure at http://wiki.centos.org/HowTos/Https to set up the ssl

Any pointers would be greatly helpful

1
  • 1
    Could you please post the certificate file and the relevant config snippets? It seems that openssl doesn't like your certificate, but without more info, it's hard to say anything.
    – Lacek
    Mar 12, 2012 at 8:24

4 Answers 4

2

The cert is probably faulty/corrupt. Can you regenerate from the authority?

For example, look at:

https://forum.startcom.org/viewtopic.php?f=15&t=2253

or

http://lists.kolab.org/pipermail/kolab-users/2005-February/001986.html

You can do some checks on the certificate using openssl:

openssl x509 -in /etc/pki/tls/certs/ssl_certificate.crt -text -noout

That should dump out the plain text of your certificate information. If it can't then there's something wrong with the certificate file.

0
9

I ran across the same issue. Heres my story and solution:

I've been saving the cert as UTF-8 with BOM (Byte order Mark) So you can just open that file with vim and save it without BOM:

# vim cert.pem
:set nobomb
:wq

via: https://stackoverflow.com/a/300474

2
  • Thank you! I could see the error using a cat file.pem and appear some strange character at the beginning of the file something like : ----- BEGIN CERTIFICATE ----
    – F.Rosado
    Jun 27, 2017 at 15:21
  • 5+ years later, this was the solution to my problem. Using Editpad Pro on Windows and UTF-8, BOM must be the default. I switched to using Windows 1252 encoding with LF only, and the error disappeared.
    – Capricorn1
    Oct 17, 2022 at 17:32
0

A common reason I've seen this happen is that the file generated by the certificate authority has DOS line endings. openssl on Linux does not like that and will throw this error. Run dos2unix on the key file to fix this.

-1
  • open up key file in text editor
  • convert from UTF --> ASCII
  • Restart apache

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .