nice new tool to show version of feisty meow
[feisty_meow.git] / scripts / security / create_certificates.sh
1
2 filename="$1"; shift
3 cert_alias="$1"; shift
4 if [ -z "$filename" -o -z "$cert_alias" ]; then
5   echo "This script needs a base portion for the certificate filename to create"
6   echo "and the alias (or short name) for the certificate."
7   echo For example:
8   echo -e "\t$(basename $0 .sh) DrakeKey \"DrakeContainer\""
9   echo would create DrakeKey.pem and DrakeKey.pfx with a cert alias of DrakeContainer.
10   exit 1
11 fi
12
13 # create PEM file.
14 openssl req -x509 -nodes -days 3650 \
15   -newkey rsa:1024 -keyout ${filename}.pem -out ${filename}.pem
16
17 # export the PEM to a PFX file.
18 openssl pkcs12 -export -out ${filename}.pfx -in ${filename}.pem -name "$cert_alias"
19
20 # export the PEM to a DER certificate file.
21 openssl x509 -inform pem -in ${filename}.pem -outform der -out ${filename}.cer
22
23
24