More tests for netpgp

This commit is contained in:
agc 2009-05-27 22:13:06 +00:00
parent e43c20ce1f
commit a95ce5ae7c
5 changed files with 45 additions and 20 deletions

View File

@ -0,0 +1,21 @@
# $NetBSD: cat.at,v 1.1 2009/05/27 22:13:06 agc Exp $
AT_SETUP([attached signature and verification])
cp ${TOPSRCDIR}/libtool file3
# Make signature
AT_CHECK([$NETPGP --homedir $testhomedir --sign file3],
[0], [ignore], [ignore])
# Verify sig file
AT_CHECK([$NETPGP --homedir $testhomedir --cat --output=file3.copy file3.gpg],
[0], [ignore], [ignore], [ignore], [diff file3.copy file3])
# Verify sig to stdout
AT_CHECK([$NETPGP --homedir $testhomedir --cat file3.gpg],
[0], [ignore], [ignore], [ignore], [diff stdout file3])
# XXXTODO: deliberately corrupt file3.gpg and attempt to verify
AT_CLEANUP

View File

@ -1,4 +1,4 @@
# $NetBSD: crypt.at,v 1.1 2009/05/27 14:42:07 agc Exp $
# $NetBSD: crypt.at,v 1.2 2009/05/27 22:13:06 agc Exp $
AT_SETUP([encryption and decryption])
@ -9,19 +9,20 @@ cp ${TOPSRCDIR}/configure file1
AT_CHECK([$NETPGP --homedir $testhomedir --encrypt file1],
[0], [ignore], [ignore])
# Verify the signed file
# Decrypt the encrypted file
AT_CHECK([$NETPGP --homedir $testhomedir --decrypt file1.gpg],
[0], [ignore], [ignore])
# Fail to verify an unsigned file
# XXX: determine how to expand $testuserid instead of hard-coding
#AT_CHECK([$NETPGP --homedir $testhomedir --decrypt file1],
# [1], [ignore],
# Decrypt and send to a different file
AT_CHECK([$NETPGP --homedir $testhomedir --decrypt --output=file1.copy file1.gpg],
[0], [ignore], [ignore], [ignore], [diff file1.copy file1])
# deliberately corrupt file1.gpg and attempt to decrypt
#sed -e 's|1|2|' file1.gpg > file2.gpg
#AT_CHECK([$NETPGP --homedir $testhomedir --decrypt file2.gpg],
# [0], [ignore],
#[netpgp: default key set to "C7AB5F325F918728"
#"file1": No signatures found - is this an encrypted file?
#/usr/src/crypto/external/bsd/netpgp-hack/lib/../dist/src/lib/reader.c:1614: Unknown, Bad hash in MDC packet
#])
# XXXTODO: deliberately corrupt file1.gpg and attempt to verify
AT_CLEANUP

View File

@ -1,4 +1,4 @@
# $NetBSD: detached.at,v 1.1 2009/05/27 14:42:07 agc Exp $
# $NetBSD: detached.at,v 1.2 2009/05/27 22:13:06 agc Exp $
AT_SETUP([detached signature and verification])
@ -12,6 +12,4 @@ AT_CHECK([$NETPGP --homedir $testhomedir --sign --detached file2],
AT_CHECK([$NETPGP --homedir $testhomedir --verify file2.sig],
[0], [ignore], [ignore])
# XXXTODO: deliberately corrupt file2.gpg and attempt to verify
AT_CLEANUP

View File

@ -1,4 +1,4 @@
# $NetBSD: testsuite.at,v 1.3 2009/05/27 14:42:07 agc Exp $
# $NetBSD: testsuite.at,v 1.4 2009/05/27 22:13:06 agc Exp $
AT_INIT([netpgp])
@ -6,3 +6,4 @@ m4_include([init.at])
m4_include([verify.at])
m4_include([detached.at])
m4_include([crypt.at])
m4_include([cat.at])

View File

@ -1,6 +1,6 @@
# $NetBSD: verify.at,v 1.4 2009/05/27 14:42:07 agc Exp $
# $NetBSD: verify.at,v 1.5 2009/05/27 22:13:06 agc Exp $
AT_SETUP([check signatures and verification])
AT_SETUP([simple signature and verification])
cp ${TOPSRCDIR}/configure file1
@ -13,10 +13,6 @@ AT_CHECK([$NETPGP --homedir $testhomedir --sign file1],
AT_CHECK([$NETPGP --homedir $testhomedir --verify file1.gpg],
[0], [ignore], [ignore])
# Cat the verified file
AT_CHECK([$NETPGP --homedir $testhomedir --cat --output=file2 file1.gpg],
[0], [ignore], [ignore])
# Fail to verify an unsigned file
# XXX: determine how to expand $testuserid instead of hard-coding
AT_CHECK([$NETPGP --homedir $testhomedir --verify file1],
@ -25,4 +21,12 @@ AT_CHECK([$NETPGP --homedir $testhomedir --verify file1],
"file1": No signatures found - is this a signed file?
])
# XXXTODO: deliberately corrupt file2.gpg and attempt to verify
sed -e 's|1|2|' file1.gpg > file2.gpg
AT_CHECK([$NETPGP --homedir $testhomedir --verify file2.gpg],
[1], [ignore],
[netpgp: default key set to "C7AB5F325F918728"
"file2.gpg": verification failure: 1 invalid signatures, 0 unknown signatures
])
AT_CLEANUP