#!/bin/sh

T=testcert
KEY=512
CA=../certs/testca.pem

/bin/rm -f $T.1 $T.2 $T.key

PATH=../apps:$PATH;
export PATH

echo "generating certificate request"

echo "There should be a 2 sequences of .'s and some +'s."
echo "There should not be more that at most 80 per line"
echo "This could take some time."

req -config test.conf -new -out testreq.pem
req -verify -in testreq.pem -noout

exit 0

# add the -enc flag to encrypt the key with CBC DES

echo "verify the signature"
SSL_CERT_DIR=../certs
export SSL_CERT_DIR
x509 -in $T.pem -outform text
verify $T.pem 
if [ $? != 0 ]; then exit 1; fi

/bin/rm -f $T.1 $T.2 $T.key $T.pem

exit 0
