From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#40118: 27.0.90; Signing emails with gpg Date: Fri, 17 Apr 2020 17:11:53 +0200 Message-ID: References: <87tv2lhg2p.fsf@skimble.plus.com> <87d08a9vb9.fsf@gmail.com> <83mu7cg0k8.fsf@gnu.org> <83pnc7enyx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="108313"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, stepnem@gmail.com, 40118@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 17 17:13:56 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPSgl-000S51-T9 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 Apr 2020 17:13:56 +0200 Original-Received: from localhost ([::1]:48310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPSgk-0005Mx-W0 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 Apr 2020 11:13:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49918) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPSfv-0004by-MV for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 11:13:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPSfu-0005jm-Br for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 11:13:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58147) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPSfu-0005jf-8H for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 11:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jPSfu-0000VV-2a for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 11:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Apr 2020 15:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40118 X-GNU-PR-Package: emacs Original-Received: via spool by 40118-submit@debbugs.gnu.org id=B40118.15871363231887 (code B ref 40118); Fri, 17 Apr 2020 15:13:02 +0000 Original-Received: (at 40118) by debbugs.gnu.org; 17 Apr 2020 15:12:03 +0000 Original-Received: from localhost ([127.0.0.1]:41460 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jPSew-0000UN-Mg for submit@debbugs.gnu.org; Fri, 17 Apr 2020 11:12:02 -0400 Original-Received: from mail-wr1-f47.google.com ([209.85.221.47]:36648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jPSev-0000Tt-10 for 40118@debbugs.gnu.org; Fri, 17 Apr 2020 11:12:01 -0400 Original-Received: by mail-wr1-f47.google.com with SMTP id u13so3471255wrp.3 for <40118@debbugs.gnu.org>; Fri, 17 Apr 2020 08:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=TefJht9S5r16oXW9s+AwbFrWQif5vzk1WfsIfaVLJCU=; b=PRuIqrDXdYKufbGiJQapbR7uqDQwMIM1M/Rl9jY65StNuNepWNk1UXying/k1JOXhE zkSDQ5wz95HDp4kMfbN+zPEDEftrD4LZCzCp07emnsuaW6eR2sUycuCAP4NrNZf9Nu7c ALZLm6tTgPAOMsoW2wbgVLgvOEbh/GqYxzsNO4BZxyk7gtilB4EZ1qMdcwxwvW+9ejBf qbBxdPOiplfClD6FeifR2trjcR99b7KPgnc7Tm+R0eLZYQuuybmml4rFJtcH1IRxoh2W 4t9+bsmDyYgPsR1L3G+0omwpjQyt1KjtVmelQ5w561/vuOHhh+blZ+fALni3pb11qD6R v5bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=TefJht9S5r16oXW9s+AwbFrWQif5vzk1WfsIfaVLJCU=; b=bw6b+UA5MNKJR/4g/p5f8qKTieNKoP8TKa+p2uxKEm9kCnYg1oufTvBlntrsl1GB1l knmxm4LrfmmPDWRLs7jsQhJ756z44xvAPUOGoNqu/EL6cDBoZnlzaXQw9mwCw4GbT4l4 USP++lO1WEsP5xTPR0wy/eImDX0BaCqmBqjTZAoArtd7xC1JgtmorLUx4vbnacUinhRz Fm3rinNEwlYqPhUkQuvQWd5GZ6tp7vZdhVJ7qSQ9P0hYXODgdvoNZ2r5lBHHTzQcA/vg qAr/r/k5mH/XxekpiOxedCq/VXMBjRn4QmQw6bqAsoJjupubHfRR5TFokPD3WzAu5yJg PX9A== X-Gm-Message-State: AGi0PuaCRk0L8ZYFxFd7LHHKrZ4fgXTgJdw3RQ79Hckaw6GW37upIu75 JOR1u20paSzE2w/AUHDqVd5Me0as X-Google-Smtp-Source: APiQypKIj7CPho7QwjZGVOe21hqSenLhs+7sif70faIbd501eBJbXO+fPCsJxSOnIc3spy0EDYPOJw== X-Received: by 2002:a5d:6504:: with SMTP id x4mr4763896wru.164.1587136314689; Fri, 17 Apr 2020 08:11:54 -0700 (PDT) Original-Received: from rpluim-mac ([2a01:e34:ecfc:a860:384e:c682:f3e3:6663]) by smtp.gmail.com with ESMTPSA id s8sm2294429wru.38.2020.04.17.08.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2020 08:11:53 -0700 (PDT) In-Reply-To: (Robert Pluim's message of "Thu, 16 Apr 2020 12:38:13 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178517 Archived-At: Since it=CA=BCs Friday afternoon, what Eli really wants to do is make another decision on whether to let something into emacs-27 just before the next rc. How about this? If it=CA=BCs not OK I=CA=BCll just adjust the = error message, if it is OK I=CA=BCll write a NEWS entry. diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el index 740e1d2b72..8abe83b937 100644 --- a/lisp/gnus/mml-sec.el +++ b/lisp/gnus/mml-sec.el @@ -937,6 +937,47 @@ mml-secure-epg-encrypt (signal (car error) (cdr error)))) cipher)) =20 +(defun mml-secure-sender-sign-query (protocol sender) + "Query whether to use SENDER to sign when using PROTOCOL. +PROTOCOL will be `OpenPGP' or `CMS' (smime). +This can also save the resulting value of +`mml-secure-smime-sign-with-sender' or +`mml-secure-openpgp-sign-with-sender' via Customize. +Returns non-nil if the user has chosen to use SENDER." + (let ((buffer (get-buffer-create "*MML sender signing options*")) + (options '((?a "always" "Sign using this sender now and sign with = message sender in future.") + (?s "session only" "Sign using this sender now, and sig= n with message sender for this session only.") + (?n "no" "Do not sign this message (and error out)"))) + answer done val) + (save-window-excursion + (pop-to-buffer buffer) + (erase-buffer) + (insert (format "No %s signing key was found for this message.\nThe = sender of this message is \"%s\".\nWould you like to attempt looking up a s= igning key based on it?" + (if (eq protocol 'OpenPGP) + "openpgp" "smime") + sender)) + (while (not done) + (setq answer (read-multiple-choice "Sign this message using the se= nder?" options)) + (cl-case (car answer) + (?a + (if (eq protocol 'OpenPGP) + (progn + (setq mml-secure-openpgp-sign-with-sender t) + (customize-save-variable 'mml-secure-openpgp-sign-with-se= nder t)) + (setq mml-secure-smime-sign-with-sender t) + (customize-save-variable 'mml-secure-smime-sign-with-sender t= )) + (setq done t + val t)) + (?s + (if (eq protocol 'OpenPGP) + (setq mml-secure-openpgp-sign-with-sender t) + (setq mml-secure-smime-sign-with-sender t)) + (setq done t + val t)) + (?n + (setq done t))))) + val)) + (defun mml-secure-epg-sign (protocol mode) ;; Based on code appearing inside mml2015-epg-sign. (let* ((context (epg-make-context protocol)) @@ -945,15 +986,21 @@ mml-secure-epg-sign (signers (mml-secure-signers context signer-names)) signature micalg) (unless signers - (let ((maybe-msg - (if mml-secure-smime-sign-with-sender - "." - "; try setting `mml-secure-smime-sign-with-sender'."))) - ;; If `mml-secure-smime-sign-with-sender' is already non-nil - ;; then there's no point advising the user to examine it. If - ;; there are any other variables worth examining, please - ;; improve this error message by having it mention them. - (error "Couldn't find any signer names%s" maybe-msg))) + (if (mml-secure-sender-sign-query protocol sender) + (setq signer-names (mml-secure-signer-names protocol sender) + signers (mml-secure-signers context signer-names))) + (unless signers + (let ((maybe-msg + (if (or mml-secure-smime-sign-with-sender + mml-secure-openpgp-sign-with-sender) + "." + "; try setting `mml-secure-smime-sign-with-sender' or 'mm= l-secure-openpgp-sign-with-sender'."))) + ;; If `mml-secure-smime-sign-with-sender' or + ;; `mml-secure-openpgp-sign-with-sender' are already non-nil + ;; then there's no point advising the user to examine them. + ;; If there are any other variables worth examining, please + ;; improve this error message by having it mention them. + (error "Couldn't find any signer names%s" maybe-msg)))) (when (eq 'OpenPGP protocol) (setf (epg-context-armor context) t) (setf (epg-context-textmode context) t)