1# $NetBSD: verify.at,v 1.10 2009/06/11 06:45:11 agc Exp $
2
3AT_SETUP([simple signature and verification])
4
5AT_CHECK([cp ${TOPSRCDIR}/configure file1], [0], [ignore], [ignore])
6
7# Sign the file
8AT_CHECK([netpgp --homedir $testhomedir --sign file1],
9    [0], [ignore], [ignore])
10
11# Verify the signed file
12AT_CHECK([netpgp --homedir $testhomedir --verify file1.gpg],
13    [0], [ignore], [ignore])
14
15# Fail to verify an unsigned file
16AT_CHECK([netpgp --homedir $testhomedir --verify file1],
17    [1], [ignore], [stderr])
18AT_CHECK([grep 'No signatures found - is this a signed file?' stderr],
19    [0], [ignore], [ignore])
20
21# Deliberately corrupt file2.gpg and attempt to verify
22sed -e 's|1|2|' file1.gpg > file2.gpg
23AT_CHECK([netpgp --homedir $testhomedir --verify file2.gpg],
24    [1], [ignore], [stderr])
25AT_CHECK([grep 'verification failure: 1 invalid signature' stderr],
26    [0], [ignore], [ignore])
27
28AT_CLEANUP
29