Closed demipixel closed 8 years ago
I use this in my startup script.
openssl genrsa -out bot.key 2048
openssl req -new -sha256 -key bot.key -out bot.csr -subj "/"
openssl x509 -req -in bot.csr -signkey bot.key -out bot.cert
You don't need to generate the certificate signing request individually. You can combine both of these into one with:
openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out certificate.pem
For convenience you can also write both the private key and the signed certificate in the same file:
openssl req -x509 -newkey rsa:2048 -nodes -keyout mumble.pem -out mumble.pem
If you want to protect the key with a pass phrase, you can leave the -nodes
option out.
Works perfectly, thanks!
That's useful. Perhaps it should be in the README instead of just saying "here's the page go figure it out"? Would be more node-beginner friendly...
Silly question, what options/command should be used to generate the public.pem and private.pem? I've looked through https://nodejs.org/api/tls.html and have still run into issues (such as:
c.context.setCert(options.cert); ^ Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
)