Skip to content

Instantly share code, notes, and snippets.

@xynova
Last active April 25, 2021 09:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xynova/41051d3898bc17b4ceec931b60e4a09c to your computer and use it in GitHub Desktop.
Save xynova/41051d3898bc17b4ceec931b60e4a09c to your computer and use it in GitHub Desktop.
Create TLS certs with openssl
# Create a private key for the ssl cert
## ref> https://www.openssl.org/docs/manmaster/apps/genrsa.html
openssl genrsa -out myTLS.key 2048
# Generate the TLS certificate request
## ref> https://www.openssl.org/docs/manmaster/apps/req.html
openssl req -new -key myTLS.key -out myTLS.req
# Country Name (2 letter code) [AU]:AU
# State or Province Name (full name) [Some-State]:NSW
# Locality Name (eg, city) []:Sydney
# Organization Name (eg, company) [Internet Widgits Pty Ltd]:dev
# Organizational Unit Name (eg, section) []:dev
# Common Name (eg, YOUR name) []:sweet-az.azurewebsites.net
# Email Address []:me@email.com
# A challenge password []:23zy!
# An optional company name []:Kloud
# Sign the request with a previously generated Root CA
openssl x509 -req -in myTLS.req -CA myRootCA.pem -CAkey myRootCA.key -CAcreateserial -out myTLS.pem -days 3650
# Pacakge your public and private key in a pkcs12 encripted file (to install with certmgr on windows)
## ref> https://www.openssl.org/docs/manmaster/apps/pkcs12.html
openssl pkcs12 -export -inkey myTLS.key -in myTLS.pem -out myTLS.pfx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment