4 reqcmd="../util/shlib_wrap.sh ../apps/openssl req"
5 x509cmd="../util/shlib_wrap.sh ../apps/openssl x509 $digest"
6 verifycmd="../util/shlib_wrap.sh ../apps/openssl verify"
7 dummycnf="../apps/openssl.cnf"
8 OPENSSL_CONF=/dev/null ; export OPENSSL_CONF
14 CAreq2="req2CA.ss" # temp
25 P1intermediate="tmp_intP1.ss"
31 P2intermediate="tmp_intP2.ss"
34 echo "make a certificate request using 'req'"
36 echo "string to make the random number generator think it has entropy" >> ./.rnd
38 if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
39 req_new='-newkey dsa:../apps/dsa512.pem'
44 $reqcmd -config $CAconf -out $CAreq -keyout $CAkey $req_new
46 echo "error using 'req' to generate a certificate request"
50 echo "convert the certificate request into a self signed certificate using 'x509'"
51 $x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey -extfile $CAconf -extensions v3_ca >err.ss
53 echo "error using 'x509' to self sign a certificate request"
58 echo "convert a certificate into a certificate request using 'x509'"
59 $x509cmd -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2 >err.ss
61 echo "error using 'x509' convert a certificate to a certificate request"
65 $reqcmd -config $dummycnf -verify -in $CAreq -noout
67 echo first generated request is invalid
71 $reqcmd -config $dummycnf -verify -in $CAreq2 -noout
73 echo second generated request is invalid
77 $verifycmd -CAfile $CAcert $CAcert
79 echo first generated cert is invalid
84 echo "make a user certificate request using 'req'"
85 $reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss
87 echo "error using 'req' to generate a user certificate request"
92 echo "sign user certificate request with the just created CA via 'x509'"
93 $x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey -extfile $Uconf -extensions v3_ee >err.ss
95 echo "error using 'x509' to sign a user certificate request"
99 $verifycmd -CAfile $CAcert $Ucert
101 echo "Certificate details"
102 $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert
105 echo "make a proxy certificate request using 'req'"
106 $reqcmd -config $P1conf -out $P1req -keyout $P1key $req_new >err.ss
108 echo "error using 'req' to generate a proxy certificate request"
113 echo "sign proxy certificate request with the just created user certificate via 'x509'"
114 $x509cmd -CAcreateserial -in $P1req -days 30 -req -out $P1cert -CA $Ucert -CAkey $Ukey -extfile $P1conf -extensions v3_proxy >err.ss
116 echo "error using 'x509' to sign a proxy certificate request"
120 cat $Ucert > $P1intermediate
121 $verifycmd -CAfile $CAcert -untrusted $P1intermediate $P1cert
123 echo "Certificate details"
124 $x509cmd -subject -issuer -startdate -enddate -noout -in $P1cert
127 echo "make another proxy certificate request using 'req'"
128 $reqcmd -config $P2conf -out $P2req -keyout $P2key $req_new >err.ss
130 echo "error using 'req' to generate another proxy certificate request"
135 echo "sign second proxy certificate request with the first proxy certificate via 'x509'"
136 $x509cmd -CAcreateserial -in $P2req -days 30 -req -out $P2cert -CA $P1cert -CAkey $P1key -extfile $P2conf -extensions v3_proxy >err.ss
138 echo "error using 'x509' to sign a second proxy certificate request"
142 cat $Ucert $P1cert > $P2intermediate
143 $verifycmd -CAfile $CAcert -untrusted $P2intermediate $P2cert
145 echo "Certificate details"
146 $x509cmd -subject -issuer -startdate -enddate -noout -in $P2cert
149 echo The generated CA certificate is $CAcert
150 echo The generated CA private key is $CAkey
152 echo The generated user certificate is $Ucert
153 echo The generated user private key is $Ukey
155 echo The first generated proxy certificate is $P1cert
156 echo The first generated proxy private key is $P1key
158 echo The second generated proxy certificate is $P2cert
159 echo The second generated proxy private key is $P2key