Skip to content

Instantly share code, notes, and snippets.

@daliborgogic
Created September 9, 2019 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daliborgogic/095e39c7446c058b42819a601dbc8468 to your computer and use it in GitHub Desktop.
Save daliborgogic/095e39c7446c058b42819a601dbc8468 to your computer and use it in GitHub Desktop.
The simplest way to generate a private key and self-signed certificate for localhost.
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment