Skip to content

Instantly share code, notes, and snippets.

@sakamoto-poteko
Created January 23, 2021 06:03
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 sakamoto-poteko/a66c1a9745d26210a54b6e11cf81ecab to your computer and use it in GitHub Desktop.
Save sakamoto-poteko/a66c1a9745d26210a54b6e11cf81ecab to your computer and use it in GitHub Desktop.
OpenSSL generate root and intermediate CA (simple)
#!/bin/bash
# Root CA
echo 'Generating Root CA'
openssl ecparam -name secp384r1 -genkey -noout -out ca.key.pem
openssl req -x509 -new -nodes -key ca.key.pem -sha512 -days 3650 -out ca.crt.pem
openssl pkcs12 -inkey ca.key.pem -in ca.crt.pem -export -out ca.pfx
# Intermediate CA
echo 'Generating Intermediate CA'
openssl ecparam -name secp384r1 -genkey -noout -out int.key.pem
openssl req -new -key int.key.pem -out int.csr.pem
openssl x509 -req -days 360 -in int.csr.pem -CA ca.crt.pem -CAkey ca.key.pem -CAcreateserial -out int.crt.pem -sha512
openssl pkcs12 -inkey int.key.pem -in int.crt.pem -export -out int.pfx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment