(defvar epa-file-passphrase-alist nil)
-(defun epa-file-passphrase-callback-function (file)
- (if (eq epg-key-id 'SYM)
+(defun epa-file-passphrase-callback-function (key-id file)
+ (if (eq key-id 'SYM)
(let ((entry (assoc file epa-file-passphrase-alist))
passphrase)
(or (copy-sequence (cdr entry))
(setq entry (list file)
epa-file-passphrase-alist (cons entry
epa-file-passphrase-alist)))
- (setq passphrase (epg-passphrase-callback-function nil))
+ (setq passphrase (epg-passphrase-callback-function key-id nil))
(setcdr entry (copy-sequence passphrase))
passphrase)))
- (epg-passphrase-callback-function nil)))
+ (epg-passphrase-callback-function key-id nil)))
(defun epa-file-handler (operation &rest args)
(save-match-data
(setq epg-pending-status-list nil))
(if (and symbol
(fboundp symbol))
- (funcall symbol process string))
- (condition-case nil
- (run-hook-with-args-until-success
- (intern (concat "epg-after-status-" status "-function"))
- string)
- (error)))))
+ (funcall symbol process string)))))
(forward-line))
(setq epg-read-point (point)))))
(setq epg-key-id 'PIN))
(defun epg-status-GET_HIDDEN (process string)
- (let ((passphrase
- (funcall (if (consp (epg-context-passphrase-callback epg-context))
- (car (epg-context-passphrase-callback epg-context))
- (epg-context-passphrase-callback epg-context))
- (if (consp (epg-context-passphrase-callback epg-context))
- (cdr (epg-context-passphrase-callback epg-context)))))
- string)
- (if passphrase
- (unwind-protect
- (progn
- (setq string (concat passphrase "\n"))
- (fillarray passphrase 0)
- (setq passphrase nil)
- (process-send-string process string))
- (if string
- (fillarray string 0))))))
+ (if (and epg-key-id
+ (string-match "\\`passphrase\\." string))
+ (let ((passphrase
+ (funcall
+ (if (consp (epg-context-passphrase-callback epg-context))
+ (car (epg-context-passphrase-callback epg-context))
+ (epg-context-passphrase-callback epg-context))
+ epg-key-id
+ (if (consp (epg-context-passphrase-callback epg-context))
+ (cdr (epg-context-passphrase-callback epg-context)))))
+ string)
+ (if passphrase
+ (unwind-protect
+ (progn
+ (setq string (concat passphrase "\n"))
+ (fillarray passphrase 0)
+ (setq passphrase nil)
+ (process-send-string process string))
+ (if string
+ (fillarray string 0)))))))
(defun epg-status-GET_BOOL (process string)
(let ((entry (assoc string epg-prompt-alist)))
(cons (cons 'delete-problem (string-to-number (match-string 1 string)))
(epg-context-result-for epg-context 'error)))))
-(defun epg-passphrase-callback-function (handback)
+(defun epg-passphrase-callback-function (key-id handback)
(read-passwd
- (if (eq epg-key-id 'SYM)
+ (if (eq key-id 'SYM)
"Passphrase for symmetric encryption: "
- (if (eq epg-key-id 'PIN)
+ (if (eq key-id 'PIN)
"Passphrase for PIN: "
- (let ((entry (assoc epg-key-id epg-user-id-alist)))
+ (let ((entry (assoc key-id epg-user-id-alist)))
(if entry
- (format "Passphrase for %s %s: " epg-key-id (cdr entry))
- (format "Passphrase for %s: " epg-key-id)))))))
+ (format "Passphrase for %s %s: " key-id (cdr entry))
+ (format "Passphrase for %s: " key-id)))))))
(defun epg-progress-callback-function (what char current total handback)
(message "%s: %d%%/%d%%" what current total))