Skip to content

Instantly share code, notes, and snippets.

@maniankara
Last active March 11, 2024 10:24
Show Gist options
  • Save maniankara/b24c50dcbb1e9f88d1bb7a78fe452b24 to your computer and use it in GitHub Desktop.
Save maniankara/b24c50dcbb1e9f88d1bb7a78fe452b24 to your computer and use it in GitHub Desktop.
Create a self signed certificate
# Without CA
openssl req -x509 -newkey rsa:4096 -sha256 -days 365 -nodes -keyout selfsigned.key -out selfsigned.crt -subj "/C=FI/ST=Uusimaa/L=Helsinki/O=Verifa Oy/OU=IT/CN=example.verifa.io/emailAddress=selfsigned@verifa.io" -addext 'subjectAltName=DNS:sample.verifa.io,DNS=sample.verifa.com'
# With CA (repeats some steps from above)
openssl req -newkey rsa:2048 -nodes -keyout selfsigned.key -out selfsigned.csr -subj "/C=FI/ST=Uusimaa/L=Helsinki/O=Verifa Oy/OU=IT/CN=server.test.com/emailAddress=test@test.com"
openssl req -x509 -sha256 -days 1825 -newkey rsa:2048 -keyout rootCA.key -out rootCA.crt -subj "/C=FI/ST=Uusimaa/L=Helsinki/O=Verifa Oy/OU=IT/CN=server.test.com/emailAddress=test@test.com" -passout pass:test123
openssl x509 -req -CA rootCA.crt -CAkey rootCA.key -in selfsigned.csr -out selfsigned.crt -days 365 -CAcreateserial -passin pass:test123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment