Skip to content

Instantly share code, notes, and snippets.

@AbhyudayaSharma
Last active June 3, 2022 07:32
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 AbhyudayaSharma/b2749c8f2d12b5769619093fa1b66e88 to your computer and use it in GitHub Desktop.
Save AbhyudayaSharma/b2749c8f2d12b5769619093fa1b66e88 to your computer and use it in GitHub Desktop.
Generate a certificate signing request in one line

Generate a CSR using OpenSSL

openssl req -new -newkey rsa:4096 -keyout key.pem -noenc -out csr.pem -sha512 \
  -addext 'subjectAltName = DNS:foo.example.com, DNS:bar.example.com, IP:192.0.2.35' \
  -subj '/C=IN/ST=State/L=Location/O=Organization/OU=OrgUnit/CN=foo.example.com/emailAddress=foo@example.com'

This creates a new RSA4096 key in key.pem and the corresponding CSR in csr.pem. The CSR can then be verified:

openssl req -in csr.pem -noout -text 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment