4 reqcmd="../apps/openssl req"
5 x509cmd="../apps/openssl x509 $digest"
6 verifycmd="../apps/openssl verify"
7 dummycnf="../apps/openssl.cnf"
13 CAreq2="req2CA.ss" # temp
21 echo "make a certificate request using 'req'"
23 echo "string to make the random number generator think it has entropy" >> ./.rnd
25 if ../apps/openssl no-rsa; then
26 req_new='-newkey dsa:../apps/dsa512.pem'
31 $reqcmd -config $CAconf -out $CAreq -keyout $CAkey $req_new #>err.ss
33 echo "error using 'req' to generate a certificate request"
37 echo "convert the certificate request into a self signed certificate using 'x509'"
38 $x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey >err.ss
40 echo "error using 'x509' to self sign a certificate request"
45 echo "convert a certificate into a certificate request using 'x509'"
46 $x509cmd -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2 >err.ss
48 echo "error using 'x509' convert a certificate to a certificate request"
52 $reqcmd -config $dummycnf -verify -in $CAreq -noout
54 echo first generated request is invalid
58 $reqcmd -config $dummycnf -verify -in $CAreq2 -noout
60 echo second generated request is invalid
64 $verifycmd -CAfile $CAcert $CAcert
66 echo first generated cert is invalid
71 echo "make another certificate request using 'req'"
72 $reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss
74 echo "error using 'req' to generate a certificate request"
79 echo "sign certificate request with the just created CA via 'x509'"
80 $x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey >err.ss
82 echo "error using 'x509' to sign a certificate request"
86 $verifycmd -CAfile $CAcert $Ucert
88 echo "Certificate details"
89 $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert
92 echo The generated CA certificate is $CAcert
93 echo The generated CA private key is $CAkey
95 echo The generated user certificate is $Ucert
96 echo The generated user private key is $Ukey