Skip to content

Instantly share code, notes, and snippets.

@gregjhogan
Last active October 25, 2016 02:46
Show Gist options
  • Select an option

  • Save gregjhogan/cbe54d793fbb20a0ae64ba9bdd34f1ff to your computer and use it in GitHub Desktop.

Select an option

Save gregjhogan/cbe54d793fbb20a0ae64ba9bdd34f1ff to your computer and use it in GitHub Desktop.
generate new openssl SSL key/cert/csr/pfx
NAME=test-cert
# generate key
openssl genrsa -out $NAME.key 2048
# generate certificate request
openssl req -new -sha256 -key $NAME.key -out $NAME.csr
# self-sign certificate (if not sending to CA)
openssl x509 -req -days 3650 -in $NAME.csr -signkey $NAME.key -out $NAME.crt
# convert to pfx
openssl pkcs12 -export -out $NAME.pfx -inkey $NAME.key -in $NAME.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment