openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
openssl rsa -in key.pem -out newkey.pem && mv newkey.pem key.pem
Or using the commands below: from this link:
- Create the private key:
openssl genrsa -out key.pem 1024
- Create the "Certificate Signing Request":
openssl req -new -key key.pem -out csr.pem
- Create the self-signed certificate:
openssl x509 -req -in csr.pem -signkey key.pem -out cert.pem
const https = require("https");