4 reqcmd="../apps/openssl req"
5 x509cmd="../apps/openssl x509 $digest"
6 verifycmd="../apps/openssl verify"
12 CAreq2="req2CA.ss" # temp
20 echo "make a certificate request using 'req'"
21 $reqcmd -config $CAconf -out $CAreq -keyout $CAkey -new #>err.ss
23 echo "error using 'req' to generate a certificate request"
27 echo "convert the certificate request into a self signed certificate using 'x509'"
28 $x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey >err.ss
30 echo "error using 'x509' to self sign a certificate request"
35 echo "convert a certificate into a certificate request using 'x509'"
36 $x509cmd -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2 >err.ss
38 echo "error using 'x509' convert a certificate to a certificate request"
42 $reqcmd -verify -in $CAreq -noout
44 echo first generated request is invalid
48 $reqcmd -verify -in $CAreq2 -noout
50 echo second generated request is invalid
54 $verifycmd -CAfile $CAcert $CAcert
56 echo first generated cert is invalid
61 echo "make another certificate request using 'req'"
62 $reqcmd -config $Uconf -out $Ureq -keyout $Ukey -new >err.ss
64 echo "error using 'req' to generate a certificate request"
69 echo "sign certificate request with the just created CA via 'x509'"
70 $x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey >err.ss
72 echo "error using 'x509' to sign a certificate request"
76 $verifycmd -CAfile $CAcert $Ucert
78 echo "Certificate details"
79 $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert
82 echo The generated CA certificate is $CAcert
83 echo The generated CA private key is $CAkey
85 echo The generated user certificate is $Ucert
86 echo The generated user private key is $Ukey