Hi,
I tried creating a pem key and csr using openssl for windows :
Test 1
OpenSSL> req -x509 -newkey rsa:2048 -keyout key_localhost.pem -out cert_localhost.pem -days 365
That created 2 files names key_localhost.pem
and cert_localhost.pem
. I pasted both files to the same level of my server.js file. However my browser been getting a security problem.
Display on the browser :
The certificate is not safe because it is self-signed.
The most valid certificate only for.
Error code: MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT
Here is my server.js
https.createServer({
key: fs.readFileSync('key_localhost1.pem'),
cert: fs.readFileSync('cert_localhost1.pem'),
passphrase: 'localhost',
}, app).listen(8080);
Test 2
I tried another thing :
openssl> req -newkey rsa:2048 -new -nodes -keyout key.pem -out key_localhost2.pem
openssl> x509 -req -days 365 -in key_localhost2.pem -signkey key.pem -out cert_localhost2.crt
That created three file names key_localhost.pem
, cert_localhost.pem
and key.pem
. But nothings change on my browser...
Here is my server.js
https.createServer({
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert_localhost2.crt'),
passphrase: 'localhost',
}, app).listen(8080);
Any help would be much appreciated.
Thanks