From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daiki Ueno Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: Re: Small patch to enable use of gpg-agent with pgg Date: Sun, 26 Mar 2006 14:06:02 +0900 Message-ID: <0443f268-1caf-4aef-9a06-daa4a59b0682@well-done.deisui.org> References: <2cd46e7f0510031250u66ea1349yb437d539ce4027ef@mail.gmail.com> <2cd46e7f0510101415t76825ea7u9749fe23da54ce@mail.gmail.com> <2cd46e7f0510121647x3c51fb65pc883ed61f4e864ab@mail.gmail.com> <2cd46e7f0510200708x4640d1c2t50743cf439e52dd4@mail.gmail.com> <87pskfq361.fsf@latte.josefsson.org> <877j6mg2af.fsf@latte.josefsson.org> <87lkv1whmh.fsf@latte.josefsson.org> <897751e5-a148-4109-8da6-6f69cce0dec0@well-done.deisui.org> <87d5gd2ts1.fsf@latte.josefsson.org> <87wteiypvv.fsf@latte.josefsson.org> <87irq1evdk.fsf@catnip.gol.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1143349577 20944 80.91.229.2 (26 Mar 2006 05:06:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 26 Mar 2006 05:06:17 +0000 (UTC) Cc: ding@gnus.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 26 07:06:12 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FNNS6-000151-8y for ged-emacs-devel@m.gmane.org; Sun, 26 Mar 2006 07:06:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FNNS5-0005dm-KH for ged-emacs-devel@m.gmane.org; Sun, 26 Mar 2006 00:06:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FNNRo-0005dT-2A for emacs-devel@gnu.org; Sun, 26 Mar 2006 00:05:52 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FNNRl-0005cq-Uw for emacs-devel@gnu.org; Sun, 26 Mar 2006 00:05:51 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FNNRl-0005cj-PC for emacs-devel@gnu.org; Sun, 26 Mar 2006 00:05:49 -0500 Original-Received: from [221.255.76.220] (helo=localhost) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FNNSv-0003r3-GO; Sun, 26 Mar 2006 00:07:01 -0500 Original-Received: from localhost ([127.0.0.1] helo=well-done.deisui.org ident=ueno) by localhost with esmtp (Exim 4.60) (envelope-from ) id 1FNNRy-00075D-AA; Sun, 26 Mar 2006 14:06:02 +0900 Original-To: Miles Bader X-Attribution: DU In-Reply-To: <87irq1evdk.fsf@catnip.gol.com> (Miles Bader's message of "Sun, 26 Mar 2006 12:29:43 +0900") User-Agent: T-gnus/6.17.3 (based on No Gnus v0.3) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 XEmacs/21.4.16 (i686-pc-linux) MULE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:52067 gmane.emacs.gnus.general:62406 Archived-At: >>>>> In <87irq1evdk.fsf@catnip.gol.com> >>>>> Miles Bader wrote: > Simon Josefsson writes: > > What do you think? It might be ugly to depend on the 'gpg: writing' > > output instead of the [GNUPG:] stuff, but I see no option here. > Of course if such a kludge is used, an important thing is to report the > problem with the "official" interface as a bug... Yes. I think the root of the problem is that gpg does not emit any trigger of signature creation. I'll propose a patch to GnuPG so as to introduce BEGIN_SIGNING and END_SIGNING status. For the meantime, how about using pgg-gpg-use-agent as a flag to indicate that GnuPG will _not_ ask a passphrase in signing? Smartcard users should have to set pgg-gpg-use-agent explicitly though. Here is the patch to the previous post: --- pgg-gpg.el~ 2006-03-26 13:48:29.000000000 +0900 +++ pgg-gpg.el 2006-03-26 13:50:43.000000000 +0900 @@ -51,6 +51,11 @@ :type '(choice (const :tag "New `--recipient' option" "--recipient") (const :tag "Old `--remote-user' option" "--remote-user"))) +(defcustom pgg-gpg-use-agent nil + "Whether to use gnupg agent for key caching." + :group 'pgg-gpg + :type 'boolean) + (defvar pgg-gpg-user-id nil "GnuPG ID of your default identity.") @@ -72,6 +77,7 @@ "--command-fd" "0" "--yes" ; overwrite "--output" output-file-name) + (if pgg-gpg-use-agent '("--use-agent")) pgg-gpg-extra-args args)) (coding-system-for-write 'binary) @@ -261,7 +267,7 @@ (if pgg-encrypt-for-me (list pgg-gpg-user-id)))))))) (process (pgg-gpg-start-process args))) - (if sign + (if (and sign (not pgg-gpg-use-agent)) (pgg-gpg-wait-for-status process '("GOOD_PASSPHRASE"))) (process-send-region process start end) (pgg-gpg-wait-for-completion process '("SIG_CREATED" "END_ENCRYPTION")))) @@ -293,7 +299,8 @@ "--local-user" pgg-gpg-user-id) (if pgg-text-mode '("--textmode")))) (process (pgg-gpg-start-process args))) - (pgg-gpg-wait-for-status process '("GOOD_PASSPHRASE")) + (unless pgg-gpg-use-agent + (pgg-gpg-wait-for-status process '("GOOD_PASSPHRASE"))) (process-send-region process start end) (pgg-gpg-wait-for-completion process '("SIG_CREATED")))) Regards, -- Daiki Ueno