[SEMI] PGG included with SEMI 1.14.6 doesn't cache GnuPG passphrase

Masao Uebayashi <[email protected]> Mon, 27 Sep 2004 01:25:09 +0900 (JST)
Newsgroups gmane.mail.emacs.mime.japanese
Message-ID <[email protected]>
NetBSD 



SEMI  1.14.6 

 
Cc: 



>Description:
When using SEMI PGG for GnuPG <-> T-Gnus integration, PGG won't cache GnuPG 
passphrases.  The problem is with the function to canonify usernames into 
key IDs:

$ gpg --with-colons --no-greeting --batch --list-secret-keys [email protected]    
sec::1024:1:89C205B4DA5BFE1D:1996-04-11::::Miles Nordin <[email protected]>::escESC:
sec::1024:1:F09D755F657F8F51:1993-02-21::::Miles Nordin <[email protected]>::esc:
$ 

The second :-delimited field is empty, meaning it's 'sec::1024' when
PGG expects something more like --list-keys's output of 'pub:u:1024' with 
a non-empty second field.  split-string will ignore separators at the 
beginning of the string when counting fields.  The small patch below fixes 
the problem for me, and should work either way.

I still have major problems decrypting/verifying GnuPG messages with 
T-Gnus, but sending them seems to be basically ok.

>How-To-Repeat:
1. install t-gnus from pkgsrc-wip

2. in .gnus:

(require 'pgg)
(setq pgg-default-scheme 'gpg)
(setq pgg-scheme 'gpg)

(setq pgg-cache-passphrase 't)                                    
(setq pgg-passphrase-cache-expiry 1800)
(setq mime-edit-pgp-user-id "[email protected]")

3. send a signed message.  press C-c C-x s in Gnus's (SEMI's) 
   MIME-Edit mode.  PGG will ask for your GnuPG passphrase.

4. send another message within 1800 seconds.  PGG can't retrieve 
   the cached passphrase.

>Fix:
I tried to contact the SEMI developers, but I can't read Japanese and
couldn't find their email.  Maybe you can pass the patch up to them?

--- pgg-gpg.el.orig	2004-09-25 15:17:14.000000000 -0400
+++ pgg-gpg.el	2004-09-25 15:41:03.000000000 -0400
@@ -140,8 +140,8 @@
       (goto-char (point-min))
       (if (re-search-forward "^\\(sec\\|pub\\):"  nil t)
 	  (substring
-	   (nth 3 (split-string
-		   (buffer-substring (match-end 0)
+	   (nth 4 (split-string
+		   (buffer-substring (+ (match-end 0) -4)
 				     (progn (end-of-line)(point)))
 		   ":")) 8)))))