emacs-devel
[Top][All Lists]
Advanced

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

Re: secure plist store


From: Daiki Ueno
Subject: Re: secure plist store
Date: Fri, 01 Jul 2011 08:10:21 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Ted Zlatanov <address@hidden> writes:

> DU> Also, if you use only symmetric encryption, you can remove the
> DU> condition Y: (if (eq key-id 'SYM) X Y)
>
> Thanks, I'll do that.

You could simplify more; patch attached:

$ bzr diff --diff-options=-w | diffstat
 auth-source.el |   30 +++++-------------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

BTW, I think you should adjust indentation of the whole file.

=== modified file 'lisp/gnus/auth-source.el'
--- lisp/gnus/auth-source.el    2011-06-30 14:25:27 +0000
+++ lisp/gnus/auth-source.el    2011-06-30 23:02:41 +0000
@@ -43,7 +43,6 @@
 (require 'mm-util)
 (require 'gnus-util)
 (require 'assoc)
-(require 'epa)
 (require 'epg)
 
 (eval-when-compile (require 'cl))
@@ -984,25 +983,7 @@
 
 (defvar auth-source-passphrase-alist nil)
 
-(defun auth-source-passphrase-callback-function (context key-id handback
-                                                         &optional sym-detail)
-  "Exactly like `epa-passphrase-callback-function' but takes an
-extra SYM-DETAIL parameter which will be printed at the end of
-the symmetric passphrase prompt, and assumes symmetric
-encryption."
-  (read-passwd
-   (format "Passphrase for symmetric encryption%s%s: "
-           ;; Add the file name to the prompt, if any.
-           (if (stringp handback)
-               (format " for %s" handback)
-             "")
-           (if (stringp sym-detail)
-               sym-detail
-             ""))
-   (eq (epg-context-operation context) 'encrypt)))
-
 (defun auth-source-token-passphrase-callback-function (context key-id file)
-  (if (eq key-id 'SYM)
       (let* ((file (file-truename file))
              (entry (assoc file auth-source-passphrase-alist))
              passphrase)
@@ -1014,14 +995,13 @@
               (unless entry
                 (setq entry (list file))
                 (push entry auth-source-passphrase-alist))
-              (setq passphrase (auth-source-passphrase-callback-function 
context
-                                                                 key-id
-                                                                 file
-                                                                 " tokens"))
+         (setq passphrase
+               (read-passwd
+                (format "Passphrase for for %s token: " file)
+                t))
               (setcdr entry (lexical-let ((p (copy-sequence passphrase)))
                               (lambda () p)))
-              passphrase)))
-    (epa-passphrase-callback-function context key-id file)))
+         passphrase))))
 
 ;; (auth-source-epa-extract-gpg-token 
"gpg:LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tClZlcnNpb246IEdudVBHIHYxLjQuMTEgKEdOVS9MaW51eCkKCmpBMEVBd01DT25qMjB1ak9rZnRneVI3K21iNm9aZWhuLzRad3cySkdlbnVaKzRpeEswWDY5di9icDI1U1dsQT0KPS9yc2wKLS0tLS1FTkQgUEdQIE1FU1NBR0UtLS0tLQo="
 "~/.netrc")
 (defun auth-source-epa-extract-gpg-token (secret file)

Regards,
-- 
Daiki Ueno

reply via email to

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