Created
September 27, 2012 18:30
-
-
Save boreal321/3795579 to your computer and use it in GitHub Desktop.
Shell script to generate a root certificate for signing client and web server certificates.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BITS=2048 | |
DAYSVALID=7300 | |
RANDDEV=/dev/urandom | |
CNF=./make_root_CA.conf | |
DER=./root_CA.der | |
PEM=./root_CA.pem | |
KEY=./root_CA.key | |
# | |
# DO NOT EDIT BEYOND THIS POINT | |
# | |
[ ! -f $KEY ] || { echo "Key file already exists: $KEY"; exit; } | |
# Issue DER-format self-signed Root CA certificate | |
openssl req -new -x509 -nodes \ | |
-config $CNF \ | |
-newkey rsa:$BITS \ | |
-rand $RANDDEV \ | |
-days $DAYSVALID \ | |
-set_serial 0 \ | |
-keyform DER \ | |
-outform DER \ | |
-out $DER | |
# Produce clean PEM-format Root CA certificate | |
openssl x509 -text -inform DER -in $DER -outform PEM -out $PEM | |
# Show root certificate | |
openssl x509 -text -inform DER -in $DER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment