Skip to content

Instantly share code, notes, and snippets.

@cmwylie19
Last active December 30, 2024 16:22
Show Gist options
  • Select an option

  • Save cmwylie19/5de1971c65ec441b824e720fe23ed270 to your computer and use it in GitHub Desktop.

Select an option

Save cmwylie19/5de1971c65ec441b824e720fe23ed270 to your computer and use it in GitHub Desktop.
Create openSSL certs

Certificates

Generate a new private key and certificate signing request

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

Generate a self-signed certificate

openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt

Generate a certificate signing request (CSR) for an existing private key

openssl req -out CSR.csr -key privateKey.key -new 

Generate a certificate signing request based on an existing certificate

openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key

Check a CSR

openssl req -text -noout -in CSR.csr

Check a private key

openssl rsa -in privateKey.key -check

Check a certificate

openssl x509 -in certificate.crt -text -noout

Check a certificate in the browser

openssl s_client -showcerts -connect localhost:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment