Instrumental | 31d847e | 2018-03-26 14:17:19 -0700 | [diff] [blame] | 1 | # |
| 2 | # Create a p12 file from local certs |
| 3 | # |
Instrumental | 31d847e | 2018-03-26 14:17:19 -0700 | [diff] [blame] | 4 | |
| 5 | if [ "$1" = "" ]; then |
Maciej Wejs | 02c1970 | 2018-08-17 13:56:31 +0200 | [diff] [blame] | 6 | echo "Enter Keystore Name: " |
| 7 | read MACH |
| 8 | else |
Instrumental | 31d847e | 2018-03-26 14:17:19 -0700 | [diff] [blame] | 9 | MACH=$1 |
| 10 | fi |
| 11 | |
Maciej Wejs | 02c1970 | 2018-08-17 13:56:31 +0200 | [diff] [blame] | 12 | # Add Cert AND Intermediate CAs (Clients will have Root CAs (or not)) |
| 13 | cat certs/$MACH.crt > $MACH.chain |
Instrumental | 924b18d | 2018-04-05 20:17:18 -0500 | [diff] [blame] | 14 | # Add THIS Intermediate CA into chain |
Maciej Wejs | 02c1970 | 2018-08-17 13:56:31 +0200 | [diff] [blame] | 15 | cat certs/ca.crt >> $MACH.chain |
Instrumental | 31d847e | 2018-03-26 14:17:19 -0700 | [diff] [blame] | 16 | |
| 17 | # Make a pkcs12 keystore, a jks keystore and a pem keystore |
| 18 | rm -f $MACH.p12 |
| 19 | # Note: Openssl will pickup and load all Certs in the Chain file |
Maciej Wejs | 02c1970 | 2018-08-17 13:56:31 +0200 | [diff] [blame] | 20 | openssl pkcs12 -name $MACH -export -in $MACH.chain -inkey private/$MACH.key -out $MACH.p12 |