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 if ../apps/openssl no-rsa; then
24 req_new='-newkey dsa:../apps/dsa512.pem'
29 $reqcmd -config $CAconf -out $CAreq -keyout $CAkey $req_new #>err.ss
31 echo "error using 'req' to generate a certificate request"
35 echo "convert the certificate request into a self signed certificate using 'x509'"
36 $x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey >err.ss
38 echo "error using 'x509' to self sign a certificate request"
43 echo "convert a certificate into a certificate request using 'x509'"
44 $x509cmd -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2 >err.ss
46 echo "error using 'x509' convert a certificate to a certificate request"
50 $reqcmd -config $dummycnf -verify -in $CAreq -noout
52 echo first generated request is invalid
56 $reqcmd -config $dummycnf -verify -in $CAreq2 -noout
58 echo second generated request is invalid
62 $verifycmd -CAfile $CAcert $CAcert
64 echo first generated cert is invalid
69 echo "make another certificate request using 'req'"
70 $reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss
72 echo "error using 'req' to generate a certificate request"
77 echo "sign certificate request with the just created CA via 'x509'"
78 $x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey >err.ss
80 echo "error using 'x509' to sign a certificate request"
84 $verifycmd -CAfile $CAcert $Ucert
86 echo "Certificate details"
87 $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert
90 echo The generated CA certificate is $CAcert
91 echo The generated CA private key is $CAkey
93 echo The generated user certificate is $Ucert
94 echo The generated user private key is $Ukey