0

I have a nodeJs http servers (Windows), created with the standard https.createServer method. I want to use a certificate I bougth from GlobalSign. They gave me a "csr" and a "pem". I saved them in a text file and tried to use them : this.fHttpServer=https.createServer({ key: 'csrFileFromGlobalSign', cert: 'pemFileFromGlobalSign' }); But it gives me an "execution error" in nodeJs : "error:0906D06C:PEM routines:PEM_read_bio:no start line"

  • I tried switching the files, same problem
  • If I try with files generated by openSSL it works (no error)

What am I missing ?

Henry Kerval
  • 392
  • 2
  • 13

1 Answers1

0

If I understood this right, the key and the cert must be extracted from the pem file using openssl. Later set key.pem to key, cert.pem to cert.

  • Thanks for the answer. I could extract the "cert" file but I couldn't extra the "key" file, I tried openssl rsa -outform der -in file.pem -out file.key, but openSsl generates an error – Henry Kerval Jul 26 '18 at 02:12
  • You need the 'nocerts' option to output a key. 'openssl pkcs12 -in filename.pem -nocerts -out key.pem' – Naren Baskara Rao Jul 26 '18 at 13:19