cancel
Showing results for 
Search instead for 
Did you mean: 

Using private key from GoDaddy on Nodejs

We purchased a domain name and SSL certificate on godaddy, but our server is not on GoDaddy. WE run Lampp and NodeJS in our server, and we are trying to set up SSL with both. There is no problem with Lampp. the private key and certificate from godaddy is working. but when i try the same files with NodeJS. it fails.

This is my js script:

var ssl = {
  key: fs.readFileSync("./key.pem",'utf8'),
  cert: fs.readFileSync("./cert.crt",'utf8'),
  ca: [fs.readFileSync('./g1.crt','utf8'), fs.readFileSync('./g2.crt','utf8'), fs.readFileSync('./g3.crt','utf8')]
};
server = require('https').createServer(ssl, app);

This is the Error

_tls_common.js:104
      c.context.setKey(options.key, options.passphrase);
                ^

Error: error:0906D06CSmiley TongueEM routinesSmiley TongueEM_read_bio:no start line
    at Object.createSecureContext (_tls_common.js:104:17)
    at Server (_tls_wrap.js:805:25)
    at new Server (https.js:54:14)
    at Object.createServer (https.js:76:10)
    at Object.<anonymous> (D:\Work\Infiniti_SH_CarShow_photobooth\server\app.js:49:27)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

After some googling, i have tried several solution: adding "utf8", spliting gd bundle, using nodepad++ to fix code. None of them helped. 

However, nodejs can use my self-signed key and certificate files. So i would like to ask. Did i generate my key incorrectly? Should I manually generate private key/CSR locally and request a new certificate on GoDaddy? or there is something wrong in my code?

1 REPLY 1

Re: Using private key from GoDaddy on Nodejs

Same issue here tried this:
https://stackoverflow.com/questions/16224064/running-ssl-node-js-server-with-godaddy-gd-bundle-crt

 

No success!

Some help would be nice.