3 # Copyright (c) 2004 - 2006 Kungliga Tekniska Högskolan
4 # (Royal Institute of Technology, Stockholm, Sweden).
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
18 # 3. Neither the name of the Institute nor the names of its contributors
19 # may be used to endorse or promote products derived from this software
20 # without specific prior written permission.
22 # THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 # ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 # $Heimdal: test_chain.in 21278 2007-06-25 04:54:43Z lha $
41 stat
="--statistic-file=${objdir}/statfile"
43 hxtool
="${TESTS_ENVIRONMENT} ./hxtool ${stat}"
44 if ${hxtool} info |
grep 'rsa: hcrypto null RSA' > /dev
/null
; then
47 if ${hxtool} info |
grep 'rand: not available' > /dev
/null
; then
52 ${hxtool} verify
--missing-revoke \
53 cert
:FILE
:$srcdir/data
/test.crt \
54 chain
:FILE
:$srcdir/data
/test.crt \
55 chain
:FILE
:$srcdir/data
/ca.crt \
56 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
59 ${hxtool} verify
--missing-revoke \
60 cert
:FILE
:$srcdir/data
/test.crt \
61 chain
:FILE
:$srcdir/data
/ca.crt \
62 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
65 ${hxtool} verify
--missing-revoke \
66 cert
:FILE
:$srcdir/data
/test.crt \
67 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
69 echo "sub-cert -> root"
70 ${hxtool} verify
--missing-revoke \
71 cert
:FILE
:$srcdir/data
/sub-cert.crt \
72 chain
:FILE
:$srcdir/data
/ca.crt \
73 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null
&& exit 1
75 echo "sub-cert -> sub-ca -> root"
76 ${hxtool} verify
--missing-revoke \
77 cert
:FILE
:$srcdir/data
/sub-cert.crt \
78 chain
:FILE
:$srcdir/data
/sub-ca.crt \
79 chain
:FILE
:$srcdir/data
/ca.crt \
80 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
82 echo "sub-cert -> sub-ca"
83 ${hxtool} verify
--missing-revoke \
84 cert
:FILE
:$srcdir/data
/sub-cert.crt \
85 anchor
:FILE
:$srcdir/data
/sub-ca.crt
> /dev
/null ||
exit 1
87 echo "sub-cert -> sub-ca -> root"
88 ${hxtool} verify
--missing-revoke \
89 cert
:FILE
:$srcdir/data
/sub-cert.crt \
90 chain
:FILE
:$srcdir/data
/sub-ca.crt \
91 chain
:FILE
:$srcdir/data
/ca.crt \
92 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
94 echo "sub-cert -> sub-ca -> root"
95 ${hxtool} verify
--missing-revoke \
96 cert
:FILE
:$srcdir/data
/sub-cert.crt \
97 chain
:FILE
:$srcdir/data
/ca.crt \
98 chain
:FILE
:$srcdir/data
/sub-ca.crt \
99 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
101 echo "sub-cert -> sub-ca -> root"
102 ${hxtool} verify
--missing-revoke \
103 cert
:FILE
:$srcdir/data
/sub-cert.crt \
104 chain
:FILE
:$srcdir/data
/sub-ca.crt \
105 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
107 echo "max depth 2 (ok)"
108 ${hxtool} verify
--missing-revoke \
110 cert
:FILE
:$srcdir/data
/sub-cert.crt \
111 chain
:FILE
:$srcdir/data
/sub-ca.crt \
112 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null
&& exit 1
114 echo "max depth 1 (fail)"
115 ${hxtool} verify
--missing-revoke \
117 cert
:FILE
:$srcdir/data
/sub-cert.crt \
118 chain
:FILE
:$srcdir/data
/sub-ca.crt \
119 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null
&& exit 1
121 echo "ocsp non-ca responder"
123 cert
:FILE
:$srcdir/data
/test.crt \
124 anchor
:FILE
:$srcdir/data
/ca.crt \
125 ocsp
:FILE
:$srcdir/data
/ocsp-resp1-ocsp.der
> /dev
/null ||
exit 1
127 echo "ocsp ca responder"
129 cert
:FILE
:$srcdir/data
/test.crt \
130 anchor
:FILE
:$srcdir/data
/ca.crt \
131 ocsp
:FILE
:$srcdir/data
/ocsp-resp1-ca.der
> /dev
/null ||
exit 1
133 echo "ocsp no-ca responder, missing cert"
135 cert
:FILE
:$srcdir/data
/test.crt \
136 anchor
:FILE
:$srcdir/data
/ca.crt \
137 ocsp
:FILE
:$srcdir/data
/ocsp-resp1-ocsp-no-cert.der
> /dev
/null
&& exit 1
139 echo "ocsp no-ca responder, missing cert, in pool"
141 cert
:FILE
:$srcdir/data
/test.crt \
142 anchor
:FILE
:$srcdir/data
/ca.crt \
143 ocsp
:FILE
:$srcdir/data
/ocsp-resp1-ocsp-no-cert.der \
144 chain
:FILE
:$srcdir/data
/ocsp-responder.crt
> /dev
/null ||
exit 1
146 echo "ocsp no-ca responder, keyHash"
148 cert
:FILE
:$srcdir/data
/test.crt \
149 anchor
:FILE
:$srcdir/data
/ca.crt \
150 ocsp
:FILE
:$srcdir/data
/ocsp-resp1-keyhash.der
> /dev
/null ||
exit 1
152 echo "ocsp revoked cert"
154 cert
:FILE
:$srcdir/data
/revoke.crt \
155 anchor
:FILE
:$srcdir/data
/ca.crt \
156 ocsp
:FILE
:$srcdir/data
/ocsp-resp2.der
> /dev
/null
&& exit 1
158 for a
in resp1-ocsp-no-cert resp1-ca resp1-keyhash resp2
; do
159 echo "ocsp print reply $a"
160 ${hxtool} ocsp-print \
161 $srcdir/data
/ocsp-
${a}.der
> /dev
/null ||
exit 1
164 echo "ocsp verify exists"
165 ${hxtool} ocsp-verify \
166 --ocsp-file=$srcdir/data
/ocsp-resp1-ca.der \
167 FILE
:$srcdir/data
/test.crt
> /dev
/null ||
exit 1
169 echo "ocsp verify not exists"
170 ${hxtool} ocsp-verify \
171 --ocsp-file=$srcdir/data
/ocsp-resp1.der \
172 FILE
:$srcdir/data
/ca.crt
> /dev
/null
&& exit 1
174 echo "ocsp verify revoked"
175 ${hxtool} ocsp-verify \
176 --ocsp-file=$srcdir/data
/ocsp-resp2.der \
177 FILE
:$srcdir/data
/revoke.crt
> /dev
/null
&& exit 1
179 echo "crl non-revoked cert"
181 cert
:FILE
:$srcdir/data
/test.crt \
182 anchor
:FILE
:$srcdir/data
/ca.crt \
183 crl
:FILE
:$srcdir/data
/crl1.der
> /dev
/null ||
exit 1
185 echo "crl revoked cert"
187 cert
:FILE
:$srcdir/data
/revoke.crt \
188 anchor
:FILE
:$srcdir/data
/ca.crt \
189 crl
:FILE
:$srcdir/data
/crl1.der
> /dev
/null
&& exit 1
192 ${hxtool} verify
--missing-revoke \
193 --allow-proxy-certificate \
194 cert
:FILE
:$srcdir/data
/proxy-test.crt \
195 chain
:FILE
:$srcdir/data
/test.crt \
196 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
198 echo "proxy cert (negative)"
199 ${hxtool} verify
--missing-revoke \
200 cert
:FILE
:$srcdir/data
/proxy-test.crt \
201 chain
:FILE
:$srcdir/data
/test.crt \
202 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null
&& exit 1
204 echo "proxy cert (level fail)"
205 ${hxtool} verify
--missing-revoke \
206 --allow-proxy-certificate \
207 cert
:FILE
:$srcdir/data
/proxy-level-test.crt \
208 chain
:FILE
:$srcdir/data
/proxy-test.crt \
209 chain
:FILE
:$srcdir/data
/test.crt \
210 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null
&& exit 1
212 echo "not a proxy cert"
213 ${hxtool} verify
--missing-revoke \
214 --allow-proxy-certificate \
215 cert
:FILE
:$srcdir/data
/no-proxy-test.crt \
216 chain
:FILE
:$srcdir/data
/test.crt \
217 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null
&& exit 1
219 echo "proxy cert (max level 10)"
220 ${hxtool} verify
--missing-revoke \
221 --allow-proxy-certificate \
222 cert
:FILE
:$srcdir/data
/proxy10-test.crt \
223 chain
:FILE
:$srcdir/data
/test.crt \
224 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
226 echo "proxy cert (second level)"
227 ${hxtool} verify
--missing-revoke \
228 --allow-proxy-certificate \
229 cert
:FILE
:$srcdir/data
/proxy10-child-test.crt \
230 chain
:FILE
:$srcdir/data
/proxy10-test.crt \
231 chain
:FILE
:$srcdir/data
/test.crt \
232 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1
234 echo "proxy cert (third level)"
235 ${hxtool} verify
--missing-revoke \
236 --allow-proxy-certificate \
237 cert
:FILE
:$srcdir/data
/proxy10-child-child-test.crt \
238 chain
:FILE
:$srcdir/data
/proxy10-child-test.crt \
239 chain
:FILE
:$srcdir/data
/proxy10-test.crt \
240 chain
:FILE
:$srcdir/data
/test.crt \
241 anchor
:FILE
:$srcdir/data
/ca.crt
> /dev
/null ||
exit 1