blob: 23e762472494ea2253801f345a6e2d3cf49b6dba [file] [log] [blame]
Instrumental31d847e2018-03-26 14:17:19 -07001#
2# Create a p12 file from local certs
3#
Instrumental31d847e2018-03-26 14:17:19 -07004
5if [ "$1" = "" ]; then
Maciej Wejs02c19702018-08-17 13:56:31 +02006 echo "Enter Keystore Name: "
7 read MACH
8else
Instrumental31d847e2018-03-26 14:17:19 -07009 MACH=$1
10fi
11
Maciej Wejs02c19702018-08-17 13:56:31 +020012 # Add Cert AND Intermediate CAs (Clients will have Root CAs (or not))
13 cat certs/$MACH.crt > $MACH.chain
Instrumental924b18d2018-04-05 20:17:18 -050014 # Add THIS Intermediate CA into chain
Maciej Wejs02c19702018-08-17 13:56:31 +020015 cat certs/ca.crt >> $MACH.chain
Instrumental31d847e2018-03-26 14:17:19 -070016
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 Wejs02c19702018-08-17 13:56:31 +020020 openssl pkcs12 -name $MACH -export -in $MACH.chain -inkey private/$MACH.key -out $MACH.p12