X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=epg.el;h=0b4d7caa642977d04d92797c4da112f502a614ac;hb=d79431c89c83c63e5c2be082a15c307a278039b7;hp=55e8d089f845a81b01468fb1f84b2d7a945a9975;hpb=007df86d88f0bee3758a449b560b5dc049aa7a5b;p=elisp%2Fepg.git diff --git a/epg.el b/epg.el index 55e8d08..0b4d7ca 100644 --- a/epg.el +++ b/epg.el @@ -1061,7 +1061,9 @@ This function is for internal use only." (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)) @@ -1076,6 +1078,7 @@ This function is for internal use only." (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*")) @@ -1092,6 +1095,10 @@ This function is for internal use only." 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) @@ -1101,9 +1108,7 @@ This function is for internal use only." (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) @@ -1193,6 +1198,11 @@ This function is for internal use only." (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) @@ -1265,11 +1275,10 @@ This function is for internal use only." (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) @@ -1313,10 +1322,11 @@ This function is for internal use only." '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 @@ -1575,6 +1585,11 @@ This function is for internal use only." (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) @@ -1832,6 +1847,10 @@ You can then use `write-region' to write new data into the file." (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