summaryrefslogtreecommitdiff
path: root/tests/openpgp-certs/testselfsigs
blob: 51acd86ef45a9856b2758cf4100e0a0cd190140c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

srcdir="${srcdir:-.}"
CERTTOOL="${certtool:-../../src/certtool} -q"
unset RETCODE

fail() {
   echo "Failure: $1" >&2
   RETCODE=${RETCODE:-${2:-1}}
}

echo "Checking OpenPGP certificate self verification"

( $CERTTOOL --pgp-certificate-info <$srcdir/selfsigs/alice.pub | grep -e "^Self Signature verification: ok" ) >/dev/null ||
  fail "Self sig Verification should have succeeded!"

( $CERTTOOL --pgp-certificate-info <$srcdir/selfsigs/alice-mallory-badsig18.pub | grep -e "^Self Signature verification: failed" ) >/dev/null ||
  fail "Self sig Verification should have failed!"
( $CERTTOOL --pgp-certificate-info <$srcdir/selfsigs/alice-mallory-irrelevantsig.pub | grep -e "^Self Signature verification: failed" ) >/dev/null ||
  fail "Self sig Verification should have failed!"
( $CERTTOOL --pgp-certificate-info <$srcdir/selfsigs/alice-mallory-nosig18.pub | grep -e "^Self Signature verification: failed" ) >/dev/null ||
  fail "Self sig Verification should have failed!"

exit ${RETCODE:-0}