Create SSL Certificate

Creating something like a self-signed certificate can be fiddly so scripting the process makes it repeatable and maintainable. Here’s the batch file template that I use.

mkdir path/to/certificates/

cd path/to/certificates/

# create Certificate Signing Request (csr) and Private Key (key) with no password (-nodes)
openssl req -config path/to/conf/openssl.cnf -out -newkey rsa:2048 -nodes -keyout -subj "/C=GB/ST=myCounty/L=myTown/O=myCompany/"

# verify the CSR
openssl req -text -in -noout -verify

openssl req -config path/to/conf/openssl.cnf -keyout -new -out

openssl rsa -in -out

openssl x509 -in -out -req -signkey -days 999999

openssl x509 -noout -text -in path/to/certificates/