Instrumental | 31d847e | 2018-03-26 14:17:19 -0700 | [diff] [blame] | 1 | # |
| 2 | # NOTE: This README is "bash" capable. bash README.txt |
| 3 | # |
| 4 | # create simple but reasonable directory structure |
| 5 | mkdir -p private certs newcerts |
| 6 | chmod 700 private |
| 7 | chmod 755 certs newcerts |
| 8 | touch index.txt |
| 9 | echo '01' > serial |
| 10 | |
| 11 | echo "IMPORTANT: If for any reason, you kill this process, type 'stty sane'" |
| 12 | echo "Enter the PassPhrase for your Key: " |
| 13 | `stty -echo` |
| 14 | #read PASSPHRASE |
| 15 | PASSPHRASE=HunkyDoryDickoryDock |
| 16 | `stty echo` |
| 17 | |
| 18 | # Create a regaular rsa encrypted key |
| 19 | openssl genrsa -aes256 -out private/ca.ekey -passout stdin 4096 << EOF |
| 20 | $PASSPHRASE |
| 21 | EOF |
| 22 | |
| 23 | # Move to a Java readable time, not this one is NOT Encrypted. |
| 24 | openssl pkcs8 -in private/ca.ekey -topk8 -nocrypt -out private/ca.key -passin stdin << EOF |
| 25 | $PASSPHRASE |
| 26 | EOF |
| 27 | chmod 400 private/ca.key private/ca.ekey |
| 28 | |
| 29 | # Generate a CA Certificate |
| 30 | openssl req -config openssl.conf \ |
| 31 | -key private/ca.key \ |
| 32 | -new -x509 -days 7300 -sha256 -extensions v3_ca \ |
| 33 | -out certs/ca.crt << EOF |
| 34 | $PASSPHRASE |
| 35 | EOF |
| 36 | |
| 37 | # All done, print result |
| 38 | openssl x509 -text -noout -in certs/ca.crt |