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 olra.theworths.org (Postfix) with ESMTP id 67C56431FD9
\r
6 for <notmuch@notmuchmail.org>; Sat, 17 Jan 2015 02:52:15 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5
\r
12 tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id E9B1nSzeg1lS for <notmuch@notmuchmail.org>;
\r
16 Sat, 17 Jan 2015 02:52:13 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id EAF16431E84
\r
21 for <notmuch@notmuchmail.org>; Sat, 17 Jan 2015 02:52:10 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
24 id 1YCQzC-0006Bl-DT; Sat, 17 Jan 2015 06:52:10 -0400
\r
25 Received: (nullmailer pid 14754 invoked by uid 1000); Sat, 17 Jan 2015
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: Jameson Graef Rollins <jrollins@finestructure.net>, Notmuch Mail
\r
29 <notmuch@notmuchmail.org>
\r
30 Subject: [PATCH 3/4] test: add S/MIME signature verification test for notmuch
\r
32 Date: Sat, 17 Jan 2015 11:51:45 +0100
\r
33 Message-Id: <1421491906-14542-4-git-send-email-david@tethera.net>
\r
34 X-Mailer: git-send-email 2.1.4
\r
35 In-Reply-To: <1421491906-14542-1-git-send-email-david@tethera.net>
\r
36 References: <1395031944-15557-1-git-send-email-jrollins@finestructure.net>
\r
37 <1421491906-14542-1-git-send-email-david@tethera.net>
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Sat, 17 Jan 2015 10:52:15 -0000
\r
52 The test is pretty much cut and paste from the PGP/MIME version, with
\r
53 obvious updates taken from notmuch output. This also requires setting
\r
54 up gpgsm infrastucture.
\r
56 test/T355-smime.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
\r
57 test/test-lib.sh | 1 +
\r
58 2 files changed, 50 insertions(+)
\r
60 diff --git a/test/T355-smime.sh b/test/T355-smime.sh
\r
61 index 01f6ecd..fbcf323 100755
\r
62 --- a/test/T355-smime.sh
\r
63 +++ b/test/T355-smime.sh
\r
65 test_description='S/MIME signature verification and decryption'
\r
71 + [ -d ${GNUPGHOME} ] && return
\r
72 + mkdir -m 0700 "$GNUPGHOME"
\r
73 + gpgsm --no-tty --import < test_suite.pem >"$GNUPGHOME"/import.log 2>&1
\r
74 + test_debug "cat $GNUPGHOME/import.log"
\r
77 test_require_external_prereq openssl
\r
78 +test_require_external_prereq gpgsm
\r
80 test_begin_subtest "Generate CA Cert"
\r
81 openssl genpkey -algorithm RSA -out ca.key -pass pass:test -des3 1024
\r
82 @@ -21,6 +31,10 @@ openssl x509 -req -in smime.csr -passin pass:test -CA ca.crt -CAkey ca.key -set_
\r
83 cat test_suite.crt smime.key > test_suite.pem
\r
84 test_expect_equal "$(openssl verify -purpose smimesign -CAfile ca.crt test_suite.pem)" "test_suite.pem: OK"
\r
88 +FINGERPRINT=$(openssl x509 -fingerprint -in test_suite.crt -noout | sed -e 's/^.*=//' -e s/://g)
\r
90 test_expect_success 'emacs delivery of S/MIME signed message' \
\r
91 'emacs_fcc_message \
\r
92 "test signed message 001" \
\r
93 @@ -38,4 +52,39 @@ This is a test signed message.
\r
95 test_expect_equal_file OUTPUT EXPECTED
\r
97 +test_begin_subtest "signature verification (notmuch CLI)"
\r
98 +output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
99 + | notmuch_json_show_sanitize \
\r
100 + | sed -e 's|"created": [1234567890]*|"created": 946728000|' \
\r
101 + -e 's|"expires": [1234567890]*|"expires": 424242424|' )
\r
102 +expected='[[[{"id": "XXXXX",
\r
104 + "excluded": false,
\r
105 + "filename": "YYYYY",
\r
106 + "timestamp": 946728000,
\r
107 + "date_relative": "2000-01-01",
\r
108 + "tags": ["inbox","signed"],
\r
109 + "headers": {"Subject": "test signed message 001",
\r
110 + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
111 + "To": "test_suite@notmuchmail.org",
\r
112 + "Date": "Sat, 01 Jan 2000 12:00:00 +0000"},
\r
113 + "body": [{"id": 1,
\r
114 + "sigstatus": [{"status": "good",
\r
115 + "fingerprint": "'$FINGERPRINT'",
\r
116 + "expires": 424242424,
\r
117 + "created": 946728000}],
\r
118 + "content-type": "multipart/signed",
\r
119 + "content": [{"id": 2,
\r
120 + "content-type": "text/plain",
\r
121 + "content": "This is a test signed message.\n"},
\r
123 + "content-length": 1930,
\r
124 + "content-transfer-encoding": "base64",
\r
125 + "content-type": "application/x-pkcs7-signature",
\r
126 + "filename": "smime.p7s"}]}]},
\r
128 +test_expect_equal_json \
\r
133 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
134 index a5428bb..98a5f54 100644
\r
135 --- a/test/test-lib.sh
\r
136 +++ b/test/test-lib.sh
\r
137 @@ -1303,3 +1303,4 @@ test_declare_external_prereq gpg
\r
138 test_declare_external_prereq python
\r
139 test_declare_external_prereq python2
\r
140 test_declare_external_prereq openssl
\r
141 +test_declare_external_prereq gpgsm
\r