#!/bin/sh

# usage
#
# createcert.sh domainname.com password
#
CMD=/usr/bin/openssl

$CMD genrsa -des3 -out $1.key -passout pass:$2 1024

echo ""
echo ""

$CMD rsa -out $1.key.unenc -in $1.key -passin pass:$2

echo ""
echo ""

$CMD req -new -key $1.key -out $1.csr -passin pass:$2

echo ""
echo ""

$CMD x509 -req -days 360 -in $1.csr -signkey $1.key -out $1.crt