user2202098
user2202098

Reputation: 860

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

To enable https on my node js app I have followed this page

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

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

Any thoughts on what else could be wrong?

Upvotes: 13

Views: 37878

Answers (2)

naresh bandari
naresh bandari

Reputation: 1

In my case I missed a character from SAML, I've realized it later.

I corrected the cert in my config, and after restart of my app the issue got resolved.

Upvotes: 0

user2202098
user2202098

Reputation: 860

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

Upvotes: 16

Related Questions