Skip to content

Instantly share code, notes, and snippets.

@sepfy
Last active March 8, 2019 03:53
Show Gist options
  • Save sepfy/abc76642f8641dad295de3de57f1b416 to your computer and use it in GitHub Desktop.
Save sepfy/abc76642f8641dad295de3de57f1b416 to your computer and use it in GitHub Desktop.
x.509 with OpenSSL
# Generate root CA
openssl req -newkey rsa:2048 -nodes -keyout root-key.pem -x509 -days 365 -out root-ca.pem
# Generate leaf CSR
openssl req -new -newkey rsa:2048 -nodes -keyout leaf-key.pem -out leaf-csr.pem
# Generate leaf CA
openssl x509 -req -days 3650 -in leaf-csr.pem \
-CA root-ca.pem -CAkey root-key.pem \
-CAcreateserial -out leaf-ca.pem
# Read pem
openssl x509 -in cert.pem -text -noout
# Read key
openssl rsa -in mykey.key -text -noout
# Read CSR
openssl req -noout -text -in my.csr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment