summaryrefslogtreecommitdiff
path: root/tests/email-print-mime-structure.sh
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2019-11-25 16:45:48 -0500
committerSean Whitton <spwhitton@spwhitton.name>2019-11-28 11:09:01 -0700
commit3c84e68d79ed84f916f1b983168d58e0f360686b (patch)
tree89b8a7cd3d883877108b1fc5a40764f75faa0cd2 /tests/email-print-mime-structure.sh
parent5aebcfb2df96cc142f1787b18849cea06f898816 (diff)
downloadmailscripts-3c84e68d79ed84f916f1b983168d58e0f360686b.tar.gz
email-print-mime-structure: decrypt S/MIME parts using gpgsm
Decrypt ciphertext using gpgsm if the user has indicated that it's ok. This includes a new element in the test suite, which uses secret key material from https://www.ietf.org/id/draft-dkg-lamps-samples-01.html Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> Acked-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'tests/email-print-mime-structure.sh')
-rwxr-xr-xtests/email-print-mime-structure.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/email-print-mime-structure.sh b/tests/email-print-mime-structure.sh
index 0b70d73..6e510ca 100755
--- a/tests/email-print-mime-structure.sh
+++ b/tests/email-print-mime-structure.sh
@@ -11,15 +11,22 @@ test_eml() {
for eml in tests/email-print-mime-structure/*.eml; do
base="${eml%%.eml}"
pgpkey="$base.pgpkey"
+ p12key="$base.p12"
if [ -e "$pgpkey" ]; then
printf "Testing %s (PGPy)\n" "${eml##*/}"
test_eml "$base" --pgpkey "$pgpkey"
testgpghome=$(mktemp -d)
- printf "Testing %s (GnuPG)\n" "${eml##*/}"
+ printf "Testing %s (GnuPG PGP/MIME)\n" "${eml##*/}"
gpg --homedir="$testgpghome" --batch --quiet --import <"$pgpkey"
GNUPGHOME="$testgpghome" test_eml "$base" --use-gpg-agent
rm -rf "$testgpghome"
+ elif [ -e "$p12key" ]; then
+ testgpghome=$(mktemp -d)
+ printf "Testing %s (GnuPG S/MIME)\n" "${eml##*/}"
+ gpgsm --pinentry-mode=loopback --passphrase-fd 4 4<<<'' --homedir="$testgpghome" --batch --quiet --import <"$p12key"
+ GNUPGHOME="$testgpghome" test_eml "$base" --use-gpg-agent
+ rm -rf "$testgpghome"
else
printf "Testing %s\n" "${eml##*/}"
test_eml "$base"