From 9b81a6cc6262d2324a29ac4780b9bef2fc7e9e5b Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 20 Apr 2006 03:29:01 +0000 Subject: [PATCH] * epa-file.el (epa-file-write-region): RECIPIENTS is now a list of key objects. * epa-dired.el (epa-dired-do-encrypt): RECIPIENTS is now a list of key objects. * epa.el (epa-select-keys): Added MODE argument. (epa-encrypt-file): RECIPIENTS is now a list of key objects. * epg.el (epg-status-SIG_CREATED): New function. (epg-start-sign): epg-context-signers is now a list of key objects. (epg-start-encrypt): RECIPIENTS is now a list of key objects. --- ChangeLog | 14 ++++++++++++++ epa-dired.el | 7 ++----- epa-file.el | 6 ++---- epa.el | 13 +++++-------- epg.el | 33 +++++++++++++++++++++++++++------ 5 files changed, 50 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index da5c4af..eb4fb26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-04-20 Daiki Ueno + + * epa-file.el (epa-file-write-region): RECIPIENTS is now a list of + key objects. + * epa-dired.el (epa-dired-do-encrypt): RECIPIENTS is now a list of + key objects. + + * epa.el (epa-select-keys): Added MODE argument. + (epa-encrypt-file): RECIPIENTS is now a list of key objects. + + * epg.el (epg-status-SIG_CREATED): New function. + (epg-start-sign): epg-context-signers is now a list of key objects. + (epg-start-encrypt): RECIPIENTS is now a list of key objects. + 2006-04-19 Daiki Ueno * epa.el (epa-verify-file): Show results in minibuffer. diff --git a/epa-dired.el b/epa-dired.el index 993fb29..06d382c 100644 --- a/epa-dired.el +++ b/epa-dired.el @@ -73,11 +73,8 @@ (while file-list (epa-encrypt-file (expand-file-name (car file-list)) - (mapcar (lambda (key) - (epg-sub-key-id - (car (epg-key-sub-key-list key)))) - (epa-select-keys "Select recipents for encryption. -If no one is selected, symmetric encryption will be performed. "))) + (epa-select-keys "Select recipents for encryption. +If no one is selected, symmetric encryption will be performed. ")) (setq file-list (cdr file-list))) (revert-buffer))) diff --git a/epa-file.el b/epa-file.el index 6ba67f2..d4c9fb2 100644 --- a/epa-file.el +++ b/epa-file.el @@ -135,12 +135,10 @@ (encode-coding-string start coding-system) (encode-coding-string (buffer-substring start end) coding-system)) - (mapcar (lambda (key) - (epg-sub-key-id (car (epg-key-sub-key-list key)))) - (unless (assoc file epa-file-passphrase-alist) + (unless (assoc file epa-file-passphrase-alist) (epa-select-keys "Select recipents for encryption. -If no one is selected, symmetric encryption will be performed. "))))) +If no one is selected, symmetric encryption will be performed. ")))) (error (if (setq entry (assoc file epa-file-passphrase-alist)) (setcdr entry nil)) diff --git a/epa.el b/epa.el index 0c90a7c..87ed7b5 100644 --- a/epa.el +++ b/epa.el @@ -290,7 +290,7 @@ (beginning-of-line) (get-text-property (point) 'epa-key)))) -(defun epa-select-keys (prompt &optional names) +(defun epa-select-keys (prompt &optional names mode) (save-excursion (unless (and epa-keys-buffer (buffer-live-p epa-keys-buffer)) @@ -311,12 +311,12 @@ (if names (while names (setq point (point)) - (epa-list-keys-1 (car names) nil) + (epa-list-keys-1 (car names) mode) (goto-char point) (epa-mark) (goto-char (point-max)) (setq names (cdr names))) - (epa-list-keys-1 nil nil)) + (epa-list-keys-1 nil mode)) (epa-keys-mode) (goto-char (point-min)) (pop-to-buffer (current-buffer)) @@ -459,11 +459,8 @@ (defun epa-encrypt-file (file recipients) (interactive (list (expand-file-name (read-file-name "File: ")) - (mapcar (lambda (key) - (epg-sub-key-id - (car (epg-key-sub-key-list key)))) - (epa-select-keys "Select recipents for encryption. -If no one is selected, symmetric encryption will be performed. ")))) + (epa-select-keys "Select recipents for encryption. +If no one is selected, symmetric encryption will be performed. "))) (let ((cipher (concat file ".gpg")) (context (epg-make-context))) (message "Encrypting %s..." (file-name-nondirectory file)) diff --git a/epg.el b/epg.el index beebfc1..d1d9160 100644 --- a/epg.el +++ b/epg.el @@ -727,6 +727,21 @@ This function is for internal use only." (cons (cons 'delete-problem (string-to-number (match-string 1 string))) (epg-context-result-for epg-context 'error))))) +(defun epg-status-SIG_CREATED (process string) + (if (string-match "\\`\\([DCS]\\) \\([0-9]+\\) \\([0-9]+\\) \ +\\([0-9A-Fa-F][0-9A-Fa-F]\\) \\(.*\\) " string) + (epg-context-set-result-for + epg-context 'sign + (cons (list (cons 'type (string-to-char (match-string 1 string))) + (cons 'pubkey-algorithm + (string-to-number (match-string 2 string))) + (cons 'digest-algorithm + (string-to-number (match-string 3 string))) + (cons 'class (string-to-number (match-string 4 string) 16)) + (cons 'creation-time (match-string 5 string)) + (cons 'fingerprint (substring string (match-end 0)))) + (epg-context-result-for epg-context 'sign))))) + (defun epg-passphrase-callback-function (key-id handback) (read-passwd (if (eq key-id 'SYM) @@ -1056,9 +1071,12 @@ If you are unsure, use synchronous version of this function "--detach-sign" "--sign"))) (apply #'nconc - (mapcar (lambda (signer) - (list "-u" signer)) - (epg-context-signers context))) + (mapcar + (lambda (signer) + (list "-u" + (epg-sub-key-id + (car (epg-key-sub-key-list signer))))) + (epg-context-signers context))) (if (epg-data-file plain) (list (epg-data-file plain))))) (epg-wait-for-status context '("BEGIN_SIGNING")) @@ -1134,9 +1152,12 @@ If you are unsure, use synchronous version of this function (list "-u" signer)) (epg-context-signers context))))) (apply #'nconc - (mapcar (lambda (recipient) - (list "-r" recipient)) - recipients)) + (mapcar + (lambda (recipient) + (list "-r" + (epg-sub-key-id + (car (epg-key-sub-key-list recipient))))) + recipients)) (if (epg-data-file plain) (list (epg-data-file plain))))) (if sign -- 1.7.10.4