4 # Make a certificate/private key pair using a locally generated
5 # root certificate and convert it to a PKCS #12 file including the
6 # the CA certificate as well.
9 echo "usage: build-key-pkcs12 <name>";
13 if test $KEY_DIR; then
15 openssl req
-days 3650 -nodes -new -keyout $1.key
-out $1.csr
-config $KEY_CONFIG && \
16 openssl ca
-days 3650 -out $1.crt
-in $1.csr
-config $KEY_CONFIG && \
17 openssl pkcs12
-export -inkey $1.key
-in $1.crt
-certfile ca.crt
-out $1.p12
&& \
18 chmod 0600 $1.key
$1.p12
20 echo you must define KEY_DIR