Check the as version on Solaris x86. People don't read INSTALL anyway. :)
[openssl.git] / test / testss
1 #!/bin/sh
2
3 digest='-mdc2'
4 reqcmd="../apps/openssl req"
5 x509cmd="../apps/openssl x509 $digest"
6 verifycmd="../apps/openssl verify"
7 dummycnf="../apps/openssl.cnf"
8
9 CAkey="keyCA.ss"
10 CAcert="certCA.ss"
11 CAreq="reqCA.ss"
12 CAconf="CAss.cnf"
13 CAreq2="req2CA.ss"      # temp
14
15 Uconf="Uss.cnf"
16 Ukey="keyU.ss"
17 Ureq="reqU.ss"
18 Ucert="certU.ss"
19
20 echo
21 echo "make a certificate request using 'req'"
22 $reqcmd -config $CAconf -out $CAreq -keyout $CAkey -new #>err.ss
23 if [ $? != 0 ]; then
24         echo "error using 'req' to generate a certificate request"
25         exit 1
26 fi
27 echo
28 echo "convert the certificate request into a self signed certificate using 'x509'"
29 $x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey >err.ss
30 if [ $? != 0 ]; then
31         echo "error using 'x509' to self sign a certificate request"
32         exit 1
33 fi
34
35 echo
36 echo "convert a certificate into a certificate request using 'x509'"
37 $x509cmd -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2 >err.ss
38 if [ $? != 0 ]; then
39         echo "error using 'x509' convert a certificate to a certificate request"
40         exit 1
41 fi
42
43 $reqcmd -config $dummycnf -verify -in $CAreq -noout
44 if [ $? != 0 ]; then
45         echo first generated request is invalid
46         exit 1
47 fi
48
49 $reqcmd -config $dummycnf -verify -in $CAreq2 -noout
50 if [ $? != 0 ]; then
51         echo second generated request is invalid
52         exit 1
53 fi
54
55 $verifycmd -CAfile $CAcert $CAcert
56 if [ $? != 0 ]; then
57         echo first generated cert is invalid
58         exit 1
59 fi
60
61 echo
62 echo "make another certificate request using 'req'"
63 $reqcmd -config $Uconf -out $Ureq -keyout $Ukey -new >err.ss
64 if [ $? != 0 ]; then
65         echo "error using 'req' to generate a certificate request"
66         exit 1
67 fi
68
69 echo
70 echo "sign certificate request with the just created CA via 'x509'"
71 $x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey >err.ss
72 if [ $? != 0 ]; then
73         echo "error using 'x509' to sign a certificate request"
74         exit 1
75 fi
76
77 $verifycmd -CAfile $CAcert $Ucert
78 echo
79 echo "Certificate details"
80 $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert
81
82 echo
83 echo The generated CA certificate is $CAcert
84 echo The generated CA private key is $CAkey
85
86 echo The generated user certificate is $Ucert
87 echo The generated user private key is $Ukey
88
89 /bin/rm err.ss
90 exit 0