#!/usr/bin/env bash

test_description='S/MIME signature verification and decryption'
. $(dirname "$0")/test-lib.sh || exit 1

test_require_external_prereq openssl
test_require_external_prereq gpgsm

FINGERPRINT=$(openssl x509 -sha1 -fingerprint -in "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e s/://g)

add_gpgsm_home

gpgsm -K

test_begin_subtest "emacs delivery of S/MIME signed message"
test_expect_success \
     'emacs_fcc_message \
     "test signed message 001" \
     "This is a test signed message." \
     "(let ((mml-secure-fail-when-key-problem t)) (mml-secure-message-sign \"smime\"))"'
test_done
