(let* ((args (append (list "--no-tty"
"--status-fd" "1"
"--yes")
- (if (string-match ":" (or (getenv "GPG_AGENT_INFO") ""))
+ (if (and (not (eq (epg-context-protocol context) 'CMS))
+ (string-match ":" (or (getenv "GPG_AGENT_INFO")
+ "")))
'("--use-agent"))
(if (and (not (eq (epg-context-protocol context) 'CMS))
(epg-context-progress-callback context))
(list "--output" (epg-context-output-file context)))
args))
(coding-system-for-write 'binary)
+ (coding-system-for-read 'binary)
process-connection-type
(orig-mode (default-file-modes))
(buffer (generate-new-buffer " *epg*"))
epg-gpg-program)
(mapconcat #'identity args " ")))))
(with-current-buffer buffer
+ (if (fboundp 'set-buffer-multibyte)
+ (set-buffer-multibyte nil))
+ (make-local-variable 'epg-last-status)
+ (setq epg-last-status nil)
(make-local-variable 'epg-read-point)
(setq epg-read-point (point-min))
(make-local-variable 'epg-process-filter-running)
(make-local-variable 'epg-key-id)
(setq epg-key-id nil)
(make-local-variable 'epg-context)
- (setq epg-context context)
- (make-local-variable 'epg-last-status)
- (setq epg-last-status nil))
+ (setq epg-context context))
(unwind-protect
(progn
(set-default-file-modes 448)
(let* ((key-id (match-string 1 string))
(user-id (match-string 2 string))
(entry (assoc key-id epg-user-id-alist)))
+ (condition-case nil
+ (if (eq (epg-context-protocol context) 'CMS)
+ (setq user-id (epg-dn-from-string user-id))
+ (setq user-id (epg--decode-coding-string user-id 'utf-8)))
+ (error))
(if entry
(setcdr entry user-id)
(setq epg-user-id-alist (cons (cons key-id user-id)
(y-or-n-p (if entry (cdr entry) (concat string "? ")))))
(defun epg--prompt-GET_BOOL-untrusted_key.override (context string)
- (if (and (equal (car epg-last-status) "USERID_HINT")
- (string-match "\\`\\([^ ]+\\) \\(.*\\)" (cdr epg-last-status)))
- (y-or-n-p (format "Untrusted key %s %s. Trust this key anyway? "
- (match-string 1 string)
- (match-string 2 string)))))
+ (y-or-n-p (if (equal (car epg-last-status) "USERID_HINT")
+ (format "Untrusted key %s. Use anyway? "
+ (cdr epg-last-status))
+ "Use untrusted key anyway? ")))
(defun epg--status-GET_BOOL (context string)
(let (inhibit-quit)
'verify
(cons (epg-make-signature status key-id)
(epg-context-result-for context 'verify)))
- (if (eq (epg-context-protocol context) 'CMS)
- (condition-case nil
+ (condition-case nil
+ (if (eq (epg-context-protocol context) 'CMS)
(setq user-id (epg-dn-from-string user-id))
- (error)))
+ (setq user-id (epg--decode-coding-string user-id 'utf-8)))
+ (error))
(if entry
(setcdr entry user-id)
(setq epg-user-id-alist
(let* ((key-id (match-string 1 string))
(user-id (match-string 2 string))
(entry (assoc key-id epg-user-id-alist)))
+ (condition-case nil
+ (if (eq (epg-context-protocol context) 'CMS)
+ (setq user-id (epg-dn-from-string user-id))
+ (setq user-id (epg--decode-coding-string user-id 'utf-8)))
+ (error))
(if entry
(setcdr entry user-id)
(setq epg-user-id-alist (cons (cons key-id user-id)
(defalias 'epg--encode-coding-string 'encode-coding-string)
(defalias 'epg--encode-coding-string 'identity))
+(if (fboundp 'decode-coding-string)
+ (defalias 'epg--decode-coding-string 'decode-coding-string)
+ (defalias 'epg--decode-coding-string 'identity))
+
(defun epg--args-from-sig-notations (notations)
(apply #'nconc
(mapcar