2006-09-04 Daiki Ueno <ueno@unixuser.org>
+ * epg.el (epg--list-keys-1): Respect epg-gpg-home-directory.
+ (epg--clear-string): New function.
+ (epg--status-GET_HIDDEN): Encode passphrase with
+ terminal-coding-system.
+
* epg-config.el (epg-gpg-minimum-version): New constant.
(epg-config--parse-version): New function.
(epg-config--compare-version): New function.
+ (epg-configuration): Respect epg-gpg-home-directory.
2006-09-03 Daiki Ueno <ueno@unixuser.org>
(let (config type)
(with-temp-buffer
(apply #'call-process epg-gpg-program nil (list t nil) nil
- '("--with-colons" "--list-config"))
+ (append (if epg-gpg-home-directory
+ (list "--homedir" epg-gpg-home-directory))
+ '("--with-colons" "--list-config")))
(goto-char (point-min))
(while (re-search-forward "^cfg:\\([^:]+\\):\\(.*\\)" nil t)
(setq type (intern (match-string 1))
(string-match "\\`passphrase\\." string))
(let (inhibit-quit
passphrase
- passphrase-with-new-line)
+ passphrase-with-new-line
+ encoded-passphrase-with-new-line)
(unwind-protect
(condition-case nil
(progn
(cdr (epg-context-passphrase-callback context)))))
(when passphrase
(setq passphrase-with-new-line (concat passphrase "\n"))
- (fillarray passphrase 0)
- (setq passphrase nil)
+ (epg--clear-string passphrase)
+ (setq passphrase nil
+ encoded-passphrase-with-new-line
+ (encode-coding-string passphrase-with-new-line
+ (terminal-coding-system)))
+
(process-send-string (epg-context-process context)
- passphrase-with-new-line)))
+ encoded-passphrase-with-new-line)))
(quit
(epg-context-set-result-for
context 'error
(epg-context-result-for context 'error)))
(delete-process (epg-context-process context))))
(if passphrase
- (fillarray passphrase 0))
+ (epg--clear-string passphrase))
(if passphrase-with-new-line
- (fillarray passphrase-with-new-line 0))))))
+ (epg--clear-string passphrase-with-new-line))
+ (if encoded-passphrase-with-new-line
+ (epg--clear-string encoded-passphrase-with-new-line))))))
(defun epg--status-GET_BOOL (context string)
(let ((entry (assoc string epg-prompt-alist))
(message "%s: %d%%/%d%%" what current total))
(defun epg--list-keys-1 (context name mode)
- (let ((args (append (list "--with-colons" "--no-greeting" "--batch"
+ (let ((args (append (if epg-gpg-home-directory
+ (list "--homedir" epg-gpg-home-directory))
+ (list "--with-colons" "--no-greeting" "--batch"
"--with-fingerprint"
"--with-fingerprint"
(if (memq mode '(t secret))
(file-directory-p tempdir)
(delete-directory tempdir))))))
+(if (fboundp 'clear-string)
+ (defalias 'epg--clear-string 'clear-string)
+ (defun epg--clear-string (string)
+ (fillarray string 0)))
+
;;;###autoload
(defun epg-cancel (context)
(if (buffer-live-p (process-buffer (epg-context-process context)))