Subject: bug#26587: 26.0.50; Gnus signs with false S/MIME key

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 09 Oct 2019 21:59:34 +0200

Torsten Bronger <[email-masked]> writes:

> When writing the message, I call (mml-secure-message-sign-smime).
> The "From:" field contains "Torsten Bronger
> <[email-masked]>".  My secret keys are:

OK, my first attempt at this ended up with Message not complaining at
all, but sending out a "signed" message with the following empty
signature:

--=-=-=
Content-Type: application/pkcs7-signature; name=smime.p7s
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7s

--=-=-=--

I've now made it bug out if it can't find any identity to sign with.

Now, for the bug you're seeing...  If I'm tracing the code right (and I
may well not be), this is what's used to find what name to sign with:

(defun mml-secure-signer-names (protocol sender)
  "Determine signer names for PROTOCOL and message from SENDER.
Returned names may be e-mail addresses or key IDs and are determined based
on `mml-secure-openpgp-signers' and `mml-secure-openpgp-sign-with-sender' with
OpenPGP or `mml-secure-smime-signers' and `mml-secure-smime-sign-with-sender'
with S/MIME."
  (if (eq 'OpenPGP protocol)
      (append mml-secure-openpgp-signers
	      (if (and mml-secure-openpgp-sign-with-sender sender)
		  (list (concat "<" sender ">"))))
    (append mml-secure-smime-signers
	    (if (and mml-secure-smime-sign-with-sender sender)
		(list (concat "<" sender ">"))))))

mml-secure-smime-sign-with-sender defaults to nil, so it's normally not
used.  So this returns just the value of mml-secure-smime-signers.
What's that variable for you?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no