SSL: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode

23,725

indentation was wrong. Needed to be multiline. i had it as single line when trying to fix it in parser

  /etc/pki/tls/certs/server.crt:
    mode: "000400"
    owner: root
    group: root
    content: |
      -----BEGIN CERTIFICATE-----
      MIIFSDCCBDCgAwIBAgIJAOA6rlWwXuEJMA0GCSqGSIb3DQEBCwUAMIG0MQswCQYD
      VQQGEwJVUzEQMA4GA1UECBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEa
Share:
23,725
user2202098
Author by

user2202098

Junior Dev

Updated on July 09, 2022

Comments

  • user2202098
    user2202098 almost 2 years

    to enable https on my node js app I have followed this page http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-nodejs.html

    and included .ebextensions\https-instance.config file in my app. I sent my csr to Godaddy and downloaded my cert file.

    when running app on local host i create my https server using the keys like below and app runs fine var options = { cert: fs.readFileSync('e03aae55b05ee109.pem'), key: fs.readFileSync('key.pem') };

    in my https-instance.config file i pasted the contents of my key and cert into area specified in the link. I validated the YAML using an online parser http://yaml-online-parser.appspot.com/

    Im getting an 503 service unavailble error when hitting domain and on checking the app logs its throwing out

    [emerg] 21361#0: PEM_read_bio_X509_AUX("/etc/pki/tls/certs/server.crt") failed (SSL: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode)

    i have validated my key and cert as described here and they match https://ma.ttias.be/openssl-validate-that-certificate-matches-signs-the-private-key/ any thoughts on what else could be wrong ??

  • Omar
    Omar almost 4 years
    how do you get your key?