Skip to content

Instantly share code, notes, and snippets.

@fritschy
Created August 25, 2020 06:28
Show Gist options
  • Save fritschy/407d66c0cc8525b8aa48d23315e7665b to your computer and use it in GitHub Desktop.
Save fritschy/407d66c0cc8525b8aa48d23315e7665b to your computer and use it in GitHub Desktop.
openssl one liners
# generate 2048 bit RSA private key (protected by DES3)
openssl genrsa -des3 -out private.pem 2048
# same generation w/o DES3
openssl genrsa -out private.pem 2048
# convert PEM to DER
openssl rsa -in private.pem -pubout -outform DER > public.der
# generate (self signed) certificate (e.g. for use in webservers)
openssl req -newkey rsa:4096 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem -subj "/CN=$DOMAIN"
openssl req -newkey rsa:4096 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem -subj "/C=Germany/ST=Germany/O=$ORGANIZATION/OU=Org/CN=$DOMAIN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment