Arpit Yadav
Arpit Yadav

Reputation: 545

NodeJs - Error: error:0906D06C:PEM routines:PEM_read_bio:no start line

I am trying to use godaddy ssl certificates on ec2. But getting this error.

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

Flow I used.

var privateKey = fs.readFileSync('3b8bc5516b18ff0.pem');
var certificate = fs.readFileSync('3b8bc5516b18ff0.crt');
/**
* And converted gd_bundele to gd0, gd1, gd2
*/
var credentials = {
  key: privateKey,
  cert: certificate,
  ca: [
    fs.readFileSync('gd0.crt'),
    fs.readFileSync('gd1.crt'),
    fs.readFileSync('gd2.crt')
  ]
};


//http.createServer(app);
var httpsServer = https.createServer(credentials, app);

Upvotes: 0

Views: 760

Answers (1)

Arpit Yadav
Arpit Yadav

Reputation: 545

I got the solution .

  1. openssl req -new -newkey rsa:2048 -nodes -keyout foo.com.pem -out foo.com.csr

  2. foo.com.pem should be passed as privatekey.

NOTE : It is important save the key with which the csr was created and sent to the godaddy (I called foo.com.pem).

Upvotes: 0

Related Questions