big svn cleanup
[anytun.git] / src / openvpn / easy-rsa / build-key-pkcs12
blobf8a057b1e65325173d2ac45d80789c9e2b575b6f
1 #!/bin/sh
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.
8 if test $# -ne 1; then
9 echo "usage: build-key-pkcs12 <name>";
10 exit 1
11 fi
13 if test $KEY_DIR; then
14 cd $KEY_DIR && \
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
19 else
20 echo you must define KEY_DIR