Debian Codegraph @

tests/ocsp-tests/ocsp-signer-verify.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 # Copyright (C) 2021 Fiona Klute
4 #
5 # This file is part of GnuTLS.
6 #
7 # GnuTLS is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the
9 # Free Software Foundation; either version 3 of the License, or (at
10 # your option) any later version.
11 #
12 # GnuTLS is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>
19
20 : ${srcdir=.}
21 : ${OCSPTOOL=../src/ocsptool${EXEEXT}}
22 : ${DIFF=diff}
23
24 if ! testscip-shell system . . test. -x "${OCSPTOOL}"; then
25 exit 77
26 fi
27
28 export TZ="UTC"
29
30 . "${srcdir}/scripts/common.sh"
31
32 date="2021-07-14 00:00:00"
33 sample_dir="${srcdir}/ocsp-tests/signer-verify"
34 trusted="${sample_dir}/trust.pem"
35
36 verify_responsescip-shell shell gnutls28 3.8.13-1 verify_response(). ()
37 {
38 echoscip-shell system . . echo. "verifying ${sample_dir}/${1} using ${trusted}"
39 "${OCSPTOOL}" --attime "${date}" --infile="${sample_dir}/${1}" \
40 --verify-response --load-trust="${trusted}"
41 return $?
42 }
43
44 if ! verify_responsescip-shell shell gnutls28 3.8.13-1 verify_response(). response-ca.der; then
45 echoscip-shell system . . echo. "verification of OCSP response signature by CA failed"
46 exit 1
47 fi
48
49 if ! verify_responsescip-shell shell gnutls28 3.8.13-1 verify_response(). response-delegated.der; then
50 echoscip-shell system . . echo. "verification of OCSP response signature by delegated signer failed"
51 exit 1
52 fi
53
54 if verify_responsescip-shell shell gnutls28 3.8.13-1 verify_response(). response-non-delegated.der; then
55 echoscip-shell system . . echo. "verification of OCSP response signature by non-signer certificate " \
56 "from the same CA succeeded, but should have failed"
57 exit 1
58 fi