I'm trying to set a signed certificate to set an HTTPS sever on nodejs. But I keep getting the following error in chrome (and similar on other browsers).
"Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error."
When I ran the same code with self signed certificate and it worked OK.
Then I ran openssl verify and seems like the certificate is OK.
$ openssl verify -CAfile ./ca.crt server.crt
server.crt: OK
This is how I run it with the signed certificate:
var privateKey = fs.readFileSync('sslcert/server.key').toString();
var certificate = fs.readFileSync('sslcert/server.crt').toString();
var ca = fs.readFileSync('sslcert/ca.crt').toString();
var credentials = {key: privateKey, cert: certificate, ca: ca};
//Start Server
https.createServer(credentials, app).listen(httpsPort, function () {
console.log("Listening on port " + httpsPort + ' (https)');
});
I found the issue, it was my mistake the server.key didn't match the server.crt. A simple test found it.
See: http://www.madboa.com/geek/openssl/#cert-test
openssl s_server -cert mycert.pem -www