Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e02dac4f6e
Fetching contributors…

Cannot retrieve contributors at this time

executable file 24 lines (19 sloc) 0.675 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/bin/bash

if [ $# -ne 2 ]
then
 echo "Usage: $0 alias \"pass phrase\""
 exit -1
fi

# Generate a 2048 bit RSA key with public exponent 3.
# Encrypt private key with provided password.
openssl genrsa -3 -out $1.pem -passout pass:"$2" 2048

# Create a self-signed cert for this key.
openssl req -new -x509 -key $1.pem -passin pass:"$2" \
        -out $1-cert.pem \
        -batch -days 10000

# Create a PKCS12 store containing the generated private key.
# Protect the keystore and the private key with the provided password.
openssl pkcs12 -export -in $1-cert.pem -inkey $1.pem -passin pass:"$2" \
        -out $1.p12 -name $1 -passout pass:"$2"

rm $1.pem
rm $1-cert.pem
Something went wrong with that request. Please try again.