X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.sh;h=cb5bb8941b52cd230e80f43a533b07bdf2ee4fec;hp=d4fcea5aa77730f6c43cab689ffef942e155a8c6;hb=92149485cb5cd4af3d2c6c4856a2423da92dc727;hpb=6d843b8199b7f20c5fb9ebfb5e874467fa7ff3fe diff --git a/test/test-lib.sh b/test/test-lib.sh index d4fcea5a..cb5bb894 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -110,10 +110,10 @@ unset ALTERNATE_EDITOR add_gnupg_home () { local output - [ -d ${GNUPGHOME} ] && return + [ -e "${GNUPGHOME}/gpg.conf" ] && return _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; } at_exit_function _gnupg_exit - mkdir -m 0700 "$GNUPGHOME" + mkdir -p -m 0700 "$GNUPGHOME" gpg --no-tty --import <$NOTMUCH_SRCDIR/test/gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1 test_debug "cat $GNUPGHOME/import.log" if (gpg --quick-random --version >/dev/null 2>&1) ; then @@ -132,13 +132,21 @@ add_gnupg_home () add_gpgsm_home () { local fpr - [ -d ${GNUPGHOME} ] && return + [ -e "$GNUPGHOME/gpgsm.conf" ] && return _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; } at_exit_function _gnupg_exit - mkdir -m 0700 "$GNUPGHOME" - gpgsm --batch --no-tty --no-common-certs-import --disable-dirmngr --import < $NOTMUCH_SRCDIR/test/smime/test.crt >"$GNUPGHOME"/import.log 2>&1 + 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 + 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" + echo include-certs::1 | 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" }