This repository has been archived by the owner on Jan 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
test-notmuch
executable file
·58 lines (53 loc) · 1.71 KB
/
test-notmuch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# testing the test vector generator with notmuch
set -e
workdir=$(mktemp -d)
mkdir -p -m 0700 "$workdir/"{g,m/{new,cur,tmp}}
cleanup() {
rm -rf "$workdir"
}
trap cleanup EXIT
export GNUPGHOME="$workdir/g"
export NOTMUCH_CONFIG="$workdir/nm-config"
cat >"$NOTMUCH_CONFIG" <<EOF
[new]
[database]
path=$workdir/m
[user]
name=Bob Babbage
[new]
tags=unread;inbox;
ignore=
[maildir]
synchronize_flags=true
[search]
exclude_tags=deleted;spam;
EOF
# from https://tools.ietf.org/html/draft-bre-openpgp-samples-00#section-2.1:
gpg --batch --quiet --no-tty --import < [email protected]
# from https://tools.ietf.org/html/draft-bre-openpgp-samples-00#section-3.2:
gpg --batch --quiet --no-tty --import < [email protected]
# from https://www.ietf.org/id/draft-dkg-lamps-samples-01.html#name-certificate-authority-certi
gpgsm --batch --no-tty --quiet --import < sample-ca.pem
# trust the CA:
cat > "$GNUPGHOME/trustlist.txt" <<EOF
4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S
EOF
gpgsm --list-keys
gpg --quiet --batch --no-tty --pinentry-mode=loopback --passphrase '' --quick-gen-key 'Local Test Suite Trust Anchor' futuredefault
gpg --quiet --batch --no-tty --yes --lsign [email protected]
notmuch new --quiet
notmuch config set index.decrypt true
for x in *.eml; do
echo "inserting $x"
< "$x" notmuch insert
done
notmuch count
for x in $(./generate-test-vectors list-vectors); do
echo "extracting crypto for $x"
notmuch show --format=json --entire-thread=false --verify=true "id:[email protected]" \
| python3 -c 'import json,sys; json.dump(json.load(sys.stdin)[0][0][0]["crypto"], sys.stdout, indent=1)'
echo
done
notmuch dump