unable to load certificate with openssl
Sometime openssl tool gives issue with reading the pem file. If the cert is pasted from a browser then CR and LF characters will be missing, and makes openssl not read/load the cert file.
Although keytool worked fine.
Error message: unable to load certificate PEM routines PEM_read_bio:bad base64 decode:pem_libc
Make sure cert is enclosed withing BEGIN CERTIFCATE and END CERTIFICATE statements
See details (from blog http://srdevspot.blogspot.com/2011/08/openssl-error0906d064pem.html)
openssl error:0906D064:PEM routines:PEM_read_bio:bad base64 decode
Although keytool worked fine.
Error message: unable to load certificate PEM routines PEM_read_bio:bad base64 decode:pem_libc
Make sure cert is enclosed withing BEGIN CERTIFCATE and END CERTIFICATE statements
See details (from blog http://srdevspot.blogspot.com/2011/08/openssl-error0906d064pem.html)
openssl error:0906D064:PEM routines:PEM_read_bio:bad base64 decode
I had a problem today where Java keytool could read a X509 certificate file, but openssl could not. Immediately, I thought, "Oh, it must be in DER instead of PEM," but it was in PEM (plain text). Then I remembered something I stumbled upon months ago: openssl is picky about PEM certificate formatting.
1. The file must contain:
-----BEGIN CERTIFICATE-----
on a separate line (i.e. it must be terminated with a newline).
2. Each line of "gibberish" must be 64 characters wide.
3. The file must end with:
-----END CERTIFICATE-----
and also be terminated with a newline.
4. Don't save the cert text with Word. It must be in ASCII.
5. Don't mix DOS and UNIX style line terminations.
So, here are a few steps you can take to normalize your certificate:
1. Run it through dos2unix
dos2unix cert.pem
2. Run it through fold
fold -w 64 cert.pem
I hope that helps what that error message means!
Pre-req's:
* OpenSSL 0.9.7a Feb 19 2003
* RHEL5
1. The file must contain:
-----BEGIN CERTIFICATE-----
on a separate line (i.e. it must be terminated with a newline).
2. Each line of "gibberish" must be 64 characters wide.
3. The file must end with:
-----END CERTIFICATE-----
and also be terminated with a newline.
4. Don't save the cert text with Word. It must be in ASCII.
5. Don't mix DOS and UNIX style line terminations.
So, here are a few steps you can take to normalize your certificate:
1. Run it through dos2unix
dos2unix cert.pem
2. Run it through fold
fold -w 64 cert.pem
I hope that helps what that error message means!
Pre-req's:
* OpenSSL 0.9.7a Feb 19 2003
* RHEL5
Comments
Post a Comment