diff options
Diffstat (limited to 'src/lib/libssl/test/testss')
-rw-r--r-- | src/lib/libssl/test/testss | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/src/lib/libssl/test/testss b/src/lib/libssl/test/testss deleted file mode 100644 index 8d3557f356..0000000000 --- a/src/lib/libssl/test/testss +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | digest='-md5' | ||
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 | |||
23 | echo "string to make the random number generator think it has entropy" >> ./.rnd | ||
24 | |||
25 | if ../apps/openssl no-rsa; then | ||
26 | req_new='-newkey dsa:../apps/dsa512.pem' | ||
27 | else | ||
28 | req_new='-new' | ||
29 | fi | ||
30 | |||
31 | $reqcmd -config $CAconf -out $CAreq -keyout $CAkey $req_new #>err.ss | ||
32 | if [ $? != 0 ]; then | ||
33 | echo "error using 'req' to generate a certificate request" | ||
34 | exit 1 | ||
35 | fi | ||
36 | echo | ||
37 | echo "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 | ||
39 | if [ $? != 0 ]; then | ||
40 | echo "error using 'x509' to self sign a certificate request" | ||
41 | exit 1 | ||
42 | fi | ||
43 | |||
44 | echo | ||
45 | echo "convert a certificate into a certificate request using 'x509'" | ||
46 | $x509cmd -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2 >err.ss | ||
47 | if [ $? != 0 ]; then | ||
48 | echo "error using 'x509' convert a certificate to a certificate request" | ||
49 | exit 1 | ||
50 | fi | ||
51 | |||
52 | $reqcmd -config $dummycnf -verify -in $CAreq -noout | ||
53 | if [ $? != 0 ]; then | ||
54 | echo first generated request is invalid | ||
55 | exit 1 | ||
56 | fi | ||
57 | |||
58 | $reqcmd -config $dummycnf -verify -in $CAreq2 -noout | ||
59 | if [ $? != 0 ]; then | ||
60 | echo second generated request is invalid | ||
61 | exit 1 | ||
62 | fi | ||
63 | |||
64 | $verifycmd -CAfile $CAcert $CAcert | ||
65 | if [ $? != 0 ]; then | ||
66 | echo first generated cert is invalid | ||
67 | exit 1 | ||
68 | fi | ||
69 | |||
70 | echo | ||
71 | echo "make another certificate request using 'req'" | ||
72 | $reqcmd -config $Uconf -out $Ureq -keyout $Ukey $req_new >err.ss | ||
73 | if [ $? != 0 ]; then | ||
74 | echo "error using 'req' to generate a certificate request" | ||
75 | exit 1 | ||
76 | fi | ||
77 | |||
78 | echo | ||
79 | echo "sign 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 | ||
81 | if [ $? != 0 ]; then | ||
82 | echo "error using 'x509' to sign a certificate request" | ||
83 | exit 1 | ||
84 | fi | ||
85 | |||
86 | $verifycmd -CAfile $CAcert $Ucert | ||
87 | echo | ||
88 | echo "Certificate details" | ||
89 | $x509cmd -subject -issuer -startdate -enddate -noout -in $Ucert | ||
90 | |||
91 | echo | ||
92 | echo The generated CA certificate is $CAcert | ||
93 | echo The generated CA private key is $CAkey | ||
94 | |||
95 | echo The generated user certificate is $Ucert | ||
96 | echo The generated user private key is $Ukey | ||
97 | |||
98 | /bin/rm err.ss | ||
99 | exit 0 | ||