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."
8 echo -e "\t$(basename $0 .sh) DrakeKey \"DrakeContainer\""
9 echo would create DrakeKey.pem and DrakeKey.pfx with a cert alias of DrakeContainer.
14 openssl req -x509 -nodes -days 3650 \
15 -newkey rsa:1024 -keyout ${filename}.pem -out ${filename}.pem
17 # export the PEM to a PFX file.
18 openssl pkcs12 -export -out ${filename}.pfx -in ${filename}.pem -name "$cert_alias"
20 # export the PEM to a DER certificate file.
21 openssl x509 -inform pem -in ${filename}.pem -outform der -out ${filename}.cer