Skip to content

Instantly share code, notes, and snippets.

@xynova
Last active July 19, 2018 15:31
Show Gist options
  • Save xynova/d6728a5a07a7599fef5570f115962e05 to your computer and use it in GitHub Desktop.
Save xynova/d6728a5a07a7599fef5570f115962e05 to your computer and use it in GitHub Desktop.
Create Root CA certs with openssl
# Create the Root CA private key
## ref> https://www.openssl.org/docs/manmaster/apps/genrsa.html
openssl genrsa -out myRootCA.key 4096
# Generate the Root CA certificate signed with the private key
## ref> https://www.openssl.org/docs/manmaster/apps/req.html
openssl req -x509 -new -nodes -key myRootCA.key -days 3650 -out myRootCA.pem
# Country Name (2 letter code) [AU]:AU
# State or Province Name (full name) [Some-State]:NSW
# Locality Name (eg, city) []:Sydney
# Organization Name (eg, company) [Internet Widgits Pty Ltd]: MY-DEV-CA
# Organizational Unit Name (eg, section) []: dev
# Common Name (eg, YOUR name) []: my-dev-ca
# Email Address []: [email protected]
# Pacakge your public and private key in a pkcs12 encripted file (to install with certmgr on windows)
## ref> https://www.openssl.org/docs/manmaster/apps/pkcs12.html
openssl pkcs12 -export -inkey myRootCA.key -in myRootCA.pem -out myRootCA.pfx
Copy link

ghost commented Sep 4, 2017

This script creates CA or only key and cert? The pfx is my CA? I can use the created files with apache server?

(sorry, my English is very bad)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment