1 Return-Path: <bremner@tesseract.cs.unb.ca>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 4D8676DE1416
\r
6 for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 10:42:41 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.128 tagged_above=-999 required=5 tests=[AWL=0.118,
\r
12 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id R_t8sj54do2y for <notmuch@notmuchmail.org>;
\r
16 Sun, 16 Aug 2015 10:42:39 -0700 (PDT)
\r
17 Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])
\r
18 by arlo.cworth.org (Postfix) with ESMTPS id 811356DE01D3
\r
19 for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 10:42:39 -0700 (PDT)
\r
20 Received: from remotemail by gitolite.debian.net with local (Exim 4.80)
\r
21 (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
22 id 1ZR1wT-0003c7-BA; Sun, 16 Aug 2015 17:41:57 +0000
\r
23 Received: (nullmailer pid 26315 invoked by uid 1000); Sun, 16 Aug 2015
\r
25 From: David Bremner <david@tethera.net>
\r
26 To: notmuch@notmuchmail.org
\r
27 Subject: [PATCH 5/8] test: add broken S/MIME signature verification test for
\r
29 Date: Sun, 16 Aug 2015 19:41:13 +0200
\r
30 Message-Id: <1439746876-23654-6-git-send-email-david@tethera.net>
\r
31 X-Mailer: git-send-email 2.5.0
\r
32 In-Reply-To: <1439746876-23654-1-git-send-email-david@tethera.net>
\r
33 References: <54CA467B.30408@gnome.org>
\r
34 <1439746876-23654-1-git-send-email-david@tethera.net>
\r
35 X-BeenThere: notmuch@notmuchmail.org
\r
36 X-Mailman-Version: 2.1.18
\r
38 List-Id: "Use and development of the notmuch mail system."
\r
39 <notmuch.notmuchmail.org>
\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
41 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
43 List-Post: <mailto:notmuch@notmuchmail.org>
\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
47 X-List-Received-Date: Sun, 16 Aug 2015 17:42:41 -0000
\r
49 The test is pretty much cut and paste from the PGP/MIME version, with
\r
50 obvious updates taken from notmuch output. This also requires setting
\r
51 up gpgsm infrastucture.
\r
53 test/T355-smime.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
\r
54 test/test-lib.sh | 1 +
\r
55 2 files changed, 51 insertions(+)
\r
57 diff --git a/test/T355-smime.sh b/test/T355-smime.sh
\r
58 index 5f3ff12..b3cc76e 100755
\r
59 --- a/test/T355-smime.sh
\r
60 +++ b/test/T355-smime.sh
\r
62 test_description='S/MIME signature verification and decryption'
\r
68 + [ -d ${GNUPGHOME} ] && return
\r
69 + mkdir -m 0700 "$GNUPGHOME"
\r
70 + gpgsm --no-tty --import < test_suite.pem >"$GNUPGHOME"/import.log 2>&1
\r
71 + test_debug "cat $GNUPGHOME/import.log"
\r
74 test_require_external_prereq openssl
\r
75 +test_require_external_prereq gpgsm
\r
77 test_begin_subtest "Generate CA Cert"
\r
78 openssl genpkey -algorithm RSA -out ca.key -pass pass:test -des3 1024
\r
79 @@ -21,6 +31,10 @@ openssl x509 -req -in smime.csr -passin pass:test -CA ca.crt -CAkey ca.key -set_
\r
80 cat test_suite.crt smime.key > test_suite.pem
\r
81 test_expect_equal "$(openssl verify -purpose smimesign -CAfile ca.crt test_suite.pem)" "test_suite.pem: OK"
\r
85 +FINGERPRINT=$(openssl x509 -fingerprint -in test_suite.crt -noout | sed -e 's/^.*=//' -e s/://g)
\r
87 test_expect_success 'emacs delivery of S/MIME signed message' \
\r
88 'emacs_fcc_message \
\r
89 "test signed message 001" \
\r
90 @@ -41,6 +55,42 @@ Verification successful
\r
92 test_expect_equal_file OUTPUT EXPECTED
\r
94 +test_begin_subtest "signature verification (notmuch CLI)"
\r
95 +test_subtest_known_broken
\r
96 +output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
97 + | notmuch_json_show_sanitize \
\r
98 + | sed -e 's|"created": [1234567890]*|"created": 946728000|' \
\r
99 + -e 's|"expires": [1234567890]*|"expires": 424242424|' )
\r
100 +expected='[[[{"id": "XXXXX",
\r
102 + "excluded": false,
\r
103 + "filename": "YYYYY",
\r
104 + "timestamp": 946728000,
\r
105 + "date_relative": "2000-01-01",
\r
106 + "tags": ["inbox","signed"],
\r
107 + "headers": {"Subject": "test signed message 001",
\r
108 + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
109 + "To": "test_suite@notmuchmail.org",
\r
110 + "Date": "Sat, 01 Jan 2000 12:00:00 +0000"},
\r
111 + "body": [{"id": 1,
\r
112 + "sigstatus": [{"status": "good",
\r
113 + "fingerprint": "'$FINGERPRINT'",
\r
114 + "expires": 424242424,
\r
115 + "created": 946728000}],
\r
116 + "content-type": "multipart/signed",
\r
117 + "content": [{"id": 2,
\r
118 + "content-type": "text/plain",
\r
119 + "content": "This is a test signed message.\n"},
\r
121 + "content-length": 1930,
\r
122 + "content-transfer-encoding": "base64",
\r
123 + "content-type": "application/x-pkcs7-signature",
\r
124 + "filename": "smime.p7s"}]}]},
\r
126 +test_expect_equal_json \
\r
130 test_begin_subtest "Decryption and signature verification (openssl)"
\r
131 notmuch show --format=raw subject:"test encrypted message 001" |\
\r
132 openssl smime -decrypt -recip test_suite.pem |\
\r
133 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
134 index 198d2bb..dff8c7a 100644
\r
135 --- a/test/test-lib.sh
\r
136 +++ b/test/test-lib.sh
\r
137 @@ -1320,4 +1320,5 @@ test_declare_external_prereq ${TEST_EMACSCLIENT}
\r
138 test_declare_external_prereq gdb
\r
139 test_declare_external_prereq gpg
\r
140 test_declare_external_prereq openssl
\r
141 +test_declare_external_prereq gpgsm
\r
142 test_declare_external_prereq ${NOTMUCH_PYTHON}
\r