+add_gpgsm_home ()
+{
+ local fpr
+ [ -e "$GNUPGHOME/gpgsm.conf" ] && return
+ _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
+ at_exit_function _gnupg_exit
+ mkdir -p -m 0700 "$GNUPGHOME"
+ openssl pkcs12 -export -passout pass: -inkey "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" \
+ < "$NOTMUCH_SRCDIR/test/smime/test.crt" | \
+ gpgsm --batch --no-tty --no-common-certs-import --pinentry-mode=loopback --passphrase-fd 3 \
+ --disable-dirmngr --import >"$GNUPGHOME"/import.log 2>&1 3<<<''
+ fpr=$(gpgsm --batch --list-key test_suite@notmuchmail.org | sed -n 's/.*fingerprint: //p')
+ echo "$fpr S relax" >> "$GNUPGHOME/trustlist.txt"
+ gpgsm --quiet --batch --no-tty --no-common-certs-import --disable-dirmngr --import < $NOTMUCH_SRCDIR/test/smime/ca.crt
+ echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> "$GNUPGHOME/trustlist.txt"
+ printf '%s::1\n' include-certs disable-crl-checks | gpgconf --output /dev/null --change-options gpgsm
+ gpgsm --batch --no-tty --no-common-certs-import --pinentry-mode=loopback --passphrase-fd 3 \
+ --disable-dirmngr --import "$NOTMUCH_SRCDIR/test/smime/bob.p12" >>"$GNUPGHOME"/import.log 2>&1 3<<<''
+ test_debug "cat $GNUPGHOME/import.log"
+}
+