[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Small patch to enable use of gpg-agent with pgg

From: Daiki Ueno
Subject: Re: Small patch to enable use of gpg-agent with pgg
Date: Sun, 26 Mar 2006 14:06:02 +0900
User-agent: T-gnus/6.17.3 (based on No Gnus v0.3) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 XEmacs/21.4.16 (i686-pc-linux) MULE

>>>>> In <address@hidden> 
>>>>>   Miles Bader <address@hidden> wrote:
> Simon Josefsson <address@hidden> 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"))
         (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"))))

Daiki Ueno

reply via email to

[Prev in Thread] Current Thread [Next in Thread]