3 test_description='S/MIME signature verification and decryption'
4 . ./test-lib.sh || exit 1
6 test_require_external_prereq openssl
7 test_require_external_prereq gpgsm
9 cp $TEST_DIRECTORY/smime/key+cert.pem test_suite.pem
11 FINGERPRINT=$(openssl x509 -fingerprint -in test_suite.pem -noout | sed -e 's/^.*=//' -e s/://g)
13 test_expect_success 'emacs delivery of S/MIME signed message' \
15 "test signed message 001" \
16 "This is a test signed message." \
17 "(mml-secure-message-sign \"smime\")"'
19 # Hard code the MML to avoid several interactive questions
20 test_expect_success 'emacs delivery of S/MIME encrypted + signed message' \
22 "test encrypted message 001" \
23 "<#secure method=smime mode=signencrypt keyfile=\\\"test_suite.pem\\\" certfile=\\\"test_suite.pem\\\">\nThis is a test encrypted message.\n"'
25 test_begin_subtest "Signature verification (openssl)"
26 notmuch show --format=raw subject:"test signed message 001" |\
27 openssl smime -verify -CAfile $TEST_DIRECTORY/smime/test.crt 2>OUTPUT
29 Verification successful
31 test_expect_equal_file EXPECTED OUTPUT
33 test_begin_subtest "Decryption and signature verification (openssl)"
34 notmuch show --format=raw subject:"test encrypted message 001" |\
35 openssl smime -decrypt -recip test_suite.pem |\
36 openssl smime -verify -CAfile $TEST_DIRECTORY/smime/test.crt 2>OUTPUT
38 Verification successful
40 test_expect_equal_file EXPECTED OUTPUT