(vector (or protocol 'OpenPGP) armor textmode include-certs
cipher-algorithm digest-algorithm compress-algorithm
#'epg-passphrase-callback-function
- #'epg-progress-callback-function
+ nil
nil nil nil nil nil)))
(defun epg-context-protocol (context)
epg-gpg-program)))
(let* ((args (append (list "--no-tty"
"--status-fd" "1"
- "--yes"
- "--enable-progress-filter")
+ "--yes")
+ (if (epg-context-progress-callback context)
+ (list "--enable-progress-filter"))
(if epg-gpg-home-directory
(list "--homedir" epg-gpg-home-directory))
(unless (eq (epg-context-protocol context) 'CMS)
(setq epg-key-id 'PIN))
(defun epg--status-GET_HIDDEN (context string)
- (if (and epg-key-id
- (string-match "\\`passphrase\\." string))
- (let (inhibit-quit
- passphrase
- passphrase-with-new-line
- encoded-passphrase-with-new-line)
- (unwind-protect
- (condition-case nil
- (progn
- (setq passphrase
- (funcall
- (if (consp (epg-context-passphrase-callback context))
- (car (epg-context-passphrase-callback context))
- (epg-context-passphrase-callback context))
- context
- epg-key-id
- (if (consp (epg-context-passphrase-callback context))
- (cdr (epg-context-passphrase-callback context)))))
- (when passphrase
- (setq passphrase-with-new-line (concat passphrase "\n"))
- (epg--clear-string passphrase)
- (setq passphrase nil)
- (if epg-passphrase-coding-system
- (progn
- (setq encoded-passphrase-with-new-line
- (encode-coding-string
- passphrase-with-new-line
- epg-passphrase-coding-system))
- (epg--clear-string passphrase-with-new-line)
- (setq passphrase-with-new-line nil))
- (setq encoded-passphrase-with-new-line
- passphrase-with-new-line
- passphrase-with-new-line nil))
- (process-send-string (epg-context-process context)
- encoded-passphrase-with-new-line)))
- (quit
- (epg-context-set-result-for
- context 'error
- (cons '(quit)
- (epg-context-result-for context 'error)))
- (delete-process (epg-context-process context))))
- (if passphrase
- (epg--clear-string passphrase))
- (if passphrase-with-new-line
- (epg--clear-string passphrase-with-new-line))
- (if encoded-passphrase-with-new-line
- (epg--clear-string encoded-passphrase-with-new-line))))))
+ (when (and epg-key-id
+ (string-match "\\`passphrase\\." string))
+ (unless (epg-context-passphrase-callback context)
+ (error "passphrase-callback not set"))
+ (let (inhibit-quit
+ passphrase
+ passphrase-with-new-line
+ encoded-passphrase-with-new-line)
+ (unwind-protect
+ (condition-case nil
+ (progn
+ (setq passphrase
+ (funcall
+ (if (consp (epg-context-passphrase-callback context))
+ (car (epg-context-passphrase-callback context))
+ (epg-context-passphrase-callback context))
+ context
+ epg-key-id
+ (if (consp (epg-context-passphrase-callback context))
+ (cdr (epg-context-passphrase-callback context)))))
+ (when passphrase
+ (setq passphrase-with-new-line (concat passphrase "\n"))
+ (epg--clear-string passphrase)
+ (setq passphrase nil)
+ (if epg-passphrase-coding-system
+ (progn
+ (setq encoded-passphrase-with-new-line
+ (encode-coding-string
+ passphrase-with-new-line
+ epg-passphrase-coding-system))
+ (epg--clear-string passphrase-with-new-line)
+ (setq passphrase-with-new-line nil))
+ (setq encoded-passphrase-with-new-line
+ passphrase-with-new-line
+ passphrase-with-new-line nil))
+ (process-send-string (epg-context-process context)
+ encoded-passphrase-with-new-line)))
+ (quit
+ (epg-context-set-result-for
+ context 'error
+ (cons '(quit)
+ (epg-context-result-for context 'error)))
+ (delete-process (epg-context-process context))))
+ (if passphrase
+ (epg--clear-string passphrase))
+ (if passphrase-with-new-line
+ (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))