(signal 'wrong-type-argument (list 'epg-context-p context)))
(aset (cdr context) 6 compress-algorithm))
-(defun epg-context-set-passphrase-callback (context
- passphrase-callback)
- "Set the function used to query passphrase."
+(defun epg-context-set-passphrase-callback (context passphrase-callback
+ &optional handback)
+ "Set the function used to query passphrase.
+If optional argument HANDBACK is specified, it is passed to CALLBACK."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aset (cdr context) 7 passphrase-callback))
-
-(defun epg-context-set-progress-callback (context progress-callback)
- "Set the function which handles progress update."
+ (aset (cdr context) 7 (if handback
+ (cons passphrase-callback handback)
+ passphrase-callback)))
+
+(defun epg-context-set-progress-callback (context progress-callback
+ &optional handback)
+ "Set the function which handles progress update.
+If optional argument HANDBACK is specified, it is passed to CALLBACK."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aset (cdr context) 8 progress-callback))
+ (aset (cdr context) 8 (if handback
+ (cons progress-callback handback)
+ progress-callback)))
(defun epg-context-set-signers (context signers)
"Set the list of key-id for singning."
"--yes")
(if (string-match ":" (or (getenv "GPG_AGENT_INFO") ""))
'("--use-agent"))
- (if (epg-context-progress-callback context)
+ (if (and (not (eq (epg-context-protocol context) 'CMS))
+ (epg-context-progress-callback context))
'("--enable-progress-filter"))
(if epg-gpg-home-directory
(list "--homedir" epg-gpg-home-directory))
(if epg-passphrase-coding-system
(progn
(setq encoded-passphrase-with-new-line
- (encode-coding-string
+ (epg--encode-coding-string
passphrase-with-new-line
- epg-passphrase-coding-system))
+ (coding-system-change-eol-conversion
+ epg-passphrase-coding-system 'unix)))
(epg--clear-string passphrase-with-new-line)
(setq passphrase-with-new-line nil))
(setq encoded-passphrase-with-new-line
(epg-sig-notations signature))))))
(defun epg--status-PROGRESS (context string)
- (if (string-match "\\`\\([^ ]+\\) \\([^ ]\\) \\([0-9]+\\) \\([0-9]+\\)"
- string)
+ (if (and (epg-context-progress-callback context)
+ (string-match "\\`\\([^ ]+\\) \\([^ ]\\) \\([0-9]+\\) \\([0-9]+\\)"
+ string))
(funcall (if (consp (epg-context-progress-callback context))
(car (epg-context-progress-callback context))
(epg-context-progress-callback context))
(defun epg--clear-string (string)
(fillarray string 0)))
+(if (fboundp 'encode-coding-string)
+ (defalias 'epg--encode-coding-string 'encode-coding-string)
+ (defalias 'epg--encode-coding-string 'identity))
+
(defun epg--args-from-sig-notations (notations)
(apply #'nconc
(mapcar
"Extract public KEYS."
(unwind-protect
(progn
- (if keys
+ (if file
(epg-context-set-output-file context file)
(epg-context-set-output-file context
(epg--make-temp-file "epg-output")))
(if entry
(if (setq entry (assq (cdr entry)
epg-delete-problem-reason-alist))
- (error "Delete keys failed: %s" (cdr entry)))
- (error "Delete keys failed" (cdr entry)))))
+ (error "Delete keys failed: %s" (cdr entry))
+ (error "Delete keys failed")))))
(epg-reset context)))
;;;###autoload