Node.js https pem error: error:0906D06C:PEM routines:PEM_read_bio:no start line

后端 未结 1 1549
情话喂你
情话喂你 2020-12-19 12:20

I got myself this files from Certificate Authority:

  • domain.com.p7b
  • domain.com.crt
  • domain.com.ca-bundle

And I tried this little

相关标签:
1条回答
  • 2020-12-19 12:37

    I little late but I hope this helps.

    If someone have work with this files : pb7, crt,ca-bundle and have this error:

    error:0906D06C:PEM routines:PEM_read_bio:no start line
    

    This would mean that this files are wrong, corrupt or was requested for another environments (windows for example) as this post says:https://serverfault.com/a/317038

    So the solution in my case was request for a new certificates and in the especifications , put the following:

    • Linux compatibility

    Also is important save the key with which the csr was created and sent to the certificator provider(I called initial.key).

    Example http://www.backwardcompatible.net/155-Setting-up-real-SSL-Nodejs-Express

    Finally , your provider will send you a zip with several files. You only need a .crt file for your node app:

    var privateKey = fs.readFileSync('/some/folder/initial.key').toString();
    var certificate = fs.readFileSync('/some/folder/certificate.crt').toString();
    var credentials = {key: privateKey, cert: certificate};
    

    Note : certificate.ca-bundle and certificate.crt files must be sent by certificator provider.

    HTH

    0 讨论(0)
提交回复
热议问题