summaryrefslogtreecommitdiff
path: root/src/lib/libssl/test/testss
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/test/testss')
-rw-r--r--src/lib/libssl/test/testss86
1 files changed, 75 insertions, 11 deletions
diff --git a/src/lib/libssl/test/testss b/src/lib/libssl/test/testss
index 8d3557f356..1a426857d3 100644
--- a/src/lib/libssl/test/testss
+++ b/src/lib/libssl/test/testss
@@ -1,9 +1,9 @@
1#!/bin/sh 1#!/bin/sh
2 2
3digest='-md5' 3digest='-sha1'
4reqcmd="../apps/openssl req" 4reqcmd="../util/shlib_wrap.sh ../apps/openssl req"
5x509cmd="../apps/openssl x509 $digest" 5x509cmd="../util/shlib_wrap.sh ../apps/openssl x509 $digest"
6verifycmd="../apps/openssl verify" 6verifycmd="../util/shlib_wrap.sh ../apps/openssl verify"
7dummycnf="../apps/openssl.cnf" 7dummycnf="../apps/openssl.cnf"
8 8
9CAkey="keyCA.ss" 9CAkey="keyCA.ss"
@@ -17,12 +17,24 @@ Ukey="keyU.ss"
17Ureq="reqU.ss" 17Ureq="reqU.ss"
18Ucert="certU.ss" 18Ucert="certU.ss"
19 19
20P1conf="P1ss.cnf"
21P1key="keyP1.ss"
22P1req="reqP1.ss"
23P1cert="certP1.ss"
24P1intermediate="tmp_intP1.ss"
25
26P2conf="P2ss.cnf"
27P2key="keyP2.ss"
28P2req="reqP2.ss"
29P2cert="certP2.ss"
30P2intermediate="tmp_intP2.ss"
31
20echo 32echo
21echo "make a certificate request using 'req'" 33echo "make a certificate request using 'req'"
22 34
23echo "string to make the random number generator think it has entropy" >> ./.rnd 35echo "string to make the random number generator think it has entropy" >> ./.rnd
24 36
25if ../apps/openssl no-rsa; then 37if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
26 req_new='-newkey dsa:../apps/dsa512.pem' 38 req_new='-newkey dsa:../apps/dsa512.pem'
27else 39else
28 req_new='-new' 40 req_new='-new'
@@ -35,7 +47,7 @@ if [ $? != 0 ]; then
35fi 47fi
36echo 48echo
37echo "convert the certificate request into a self signed certificate using 'x509'" 49echo "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 50$x509cmd -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey -extfile $CAconf -extensions v3_ca >err.ss
39if [ $? != 0 ]; then 51if [ $? != 0 ]; then
40 echo "error using 'x509' to self sign a certificate request" 52 echo "error using 'x509' to self sign a certificate request"
41 exit 1 53 exit 1
@@ -68,18 +80,18 @@ if [ $? != 0 ]; then
68fi 80fi
69 81
70echo 82echo
71echo "make another certificate request using 'req'" 83echo "make a user certificate request using 'req'"
72$reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss 84$reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss
73if [ $? != 0 ]; then 85if [ $? != 0 ]; then
74 echo "error using 'req' to generate a certificate request" 86 echo "error using 'req' to generate a user certificate request"
75 exit 1 87 exit 1
76fi 88fi
77 89
78echo 90echo
79echo "sign certificate request with the just created CA via 'x509'" 91echo "sign user 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 92$x509cmd -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey -extfile $Uconf -extensions v3_ee >err.ss
81if [ $? != 0 ]; then 93if [ $? != 0 ]; then
82 echo "error using 'x509' to sign a certificate request" 94 echo "error using 'x509' to sign a user certificate request"
83 exit 1 95 exit 1
84fi 96fi
85 97
@@ -89,11 +101,63 @@ echo "Certificate details"
89$x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert 101$x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert
90 102
91echo 103echo
104echo "make a proxy certificate request using 'req'"
105$reqcmd -config $P1conf -out $P1req -keyout $P1key $req_new >err.ss
106if [ $? != 0 ]; then
107 echo "error using 'req' to generate a proxy certificate request"
108 exit 1
109fi
110
111echo
112echo "sign proxy certificate request with the just created user certificate via 'x509'"
113$x509cmd -CAcreateserial -in $P1req -days 30 -req -out $P1cert -CA $Ucert -CAkey $Ukey -extfile $P1conf -extensions v3_proxy >err.ss
114if [ $? != 0 ]; then
115 echo "error using 'x509' to sign a proxy certificate request"
116 exit 1
117fi
118
119cat $Ucert > $P1intermediate
120$verifycmd -CAfile $CAcert -untrusted $P1intermediate $P1cert
121echo
122echo "Certificate details"
123$x509cmd -subject -issuer -startdate -enddate -noout -in $P1cert
124
125echo
126echo "make another proxy certificate request using 'req'"
127$reqcmd -config $P2conf -out $P2req -keyout $P2key $req_new >err.ss
128if [ $? != 0 ]; then
129 echo "error using 'req' to generate another proxy certificate request"
130 exit 1
131fi
132
133echo
134echo "sign second proxy certificate request with the first proxy certificate via 'x509'"
135$x509cmd -CAcreateserial -in $P2req -days 30 -req -out $P2cert -CA $P1cert -CAkey $P1key -extfile $P2conf -extensions v3_proxy >err.ss
136if [ $? != 0 ]; then
137 echo "error using 'x509' to sign a second proxy certificate request"
138 exit 1
139fi
140
141cat $Ucert $P1cert > $P2intermediate
142$verifycmd -CAfile $CAcert -untrusted $P2intermediate $P2cert
143echo
144echo "Certificate details"
145$x509cmd -subject -issuer -startdate -enddate -noout -in $P2cert
146
147echo
92echo The generated CA certificate is $CAcert 148echo The generated CA certificate is $CAcert
93echo The generated CA private key is $CAkey 149echo The generated CA private key is $CAkey
94 150
95echo The generated user certificate is $Ucert 151echo The generated user certificate is $Ucert
96echo The generated user private key is $Ukey 152echo The generated user private key is $Ukey
97 153
154echo The first generated proxy certificate is $P1cert
155echo The first generated proxy private key is $P1key
156
157echo The second generated proxy certificate is $P2cert
158echo The second generated proxy private key is $P2key
159
98/bin/rm err.ss 160/bin/rm err.ss
161#/bin/rm $P1intermediate
162#/bin/rm $P2intermediate
99exit 0 163exit 0