corrected copyright notices
[gnutls.git] / tests / openpgp-certs / testselfsigs
blob3c99a6f6563884f85d216db0342c052a0586b657
1 #!/bin/sh
3 # Copyright (C) 2010, 2012 Free Software Foundation, Inc.
5 # Author: Nikos Mavrogiannopoulos
7 # This file is part of GnuTLS.
9 # GnuTLS is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by the
11 # Free Software Foundation; either version 3 of the License, or (at
12 # your option) any later version.
14 # GnuTLS is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GnuTLS; if not, write to the Free Software Foundation,
21 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 set -e
25 srcdir="${srcdir:-.}"
26 CERTTOOL="${CERTTOOL:-../../src/certtool$EXEEXT}"
28 unset RETCODE || true
30 fail() {
31 echo "Failure: $1" >&2
32 RETCODE=${RETCODE:-${2:-1}}
35 echo "Checking OpenPGP certificate self verification"
37 ($CERTTOOL --inraw --pgp-certificate-info --infile $srcdir/selfsigs/alice.pub \
38 | grep "^Self Signature verification: ok" > /dev/null) || \
39 fail "Self sig Verification should have succeeded!"
41 ($CERTTOOL --inraw --pgp-certificate-info --infile $srcdir/selfsigs/alice-mallory-badsig18.pub \
42 | grep "^Self Signature verification: failed" > /dev/null) || \
43 fail "Self sig Verification should have failed!"
45 ($CERTTOOL --inraw --pgp-certificate-info --infile $srcdir/selfsigs/alice-mallory-irrelevantsig.pub \
46 | grep "^Self Signature verification: failed" >/dev/null) || \
47 fail "Self sig Verification should have failed!"
49 ($CERTTOOL --inraw --pgp-certificate-info --infile $srcdir/selfsigs/alice-mallory-nosig18.pub \
50 | grep "^Self Signature verification: failed" >/dev/null) || \
51 fail "Self sig Verification should have failed!"
53 exit ${RETCODE:-0}