#!/bin/sh

PATH=../apps:$PATH
export PATH

SSLEAY_CONFIG="-config CAss.cnf"
export SSLEAY_CONFIG

/bin/rm -fr demoCA
sh ../apps/CA.sh -newca <<EOF
EOF

if [ $? != 0 ]; then
	exit 1;
fi

SSLEAY_CONFIG="-config Uss.cnf"
export SSLEAY_CONFIG
sh ../apps/CA.sh -newreq
if [ $? != 0 ]; then
	exit 1;
fi


SSLEAY_CONFIG="-config ../apps/ssleay.cnf"
export SSLEAY_CONFIG
sh ../apps/CA.sh -sign  <<EOF
y
y
EOF
if [ $? != 0 ]; then
	exit 1;
fi


sh ../apps/CA.sh -verify newcert.pem
if [ $? != 0 ]; then
	exit 1;
fi

/bin/rm -fr demoCA newcert.pem newreq.pem
#usage: CA -newcert|-newreq|-newca|-sign|-verify

