From: Lars Ingebrigtsen Date: Wed, 9 Dec 2020 12:17:06 +0000 (+0100) Subject: Filter revoked keys when saving files X-Git-Tag: emacs-28.0.90~4828 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=45630ca6c839719dfc92583de5e606abba4b5718;p=emacs.git Filter revoked keys when saving files * lisp/epa-file.el (epa-file-write-region): Use it to select a non-revoked key (bug#22359). * lisp/epg.el (epg--filter-revoked-keys): New function. --- diff --git a/lisp/epa-file.el b/lisp/epa-file.el index 7fd41784746..21dc1ebaff0 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -309,7 +309,8 @@ encryption is used." If no one is selected, symmetric encryption will be performed. " recipients) (if epa-file-encrypt-to - (epg-list-keys context recipients))))) + (epg--filter-revoked-keys + (epg-list-keys context recipients)))))) (error (epa-display-error context) (if (setq entry (assoc file epa-file-passphrase-alist)) diff --git a/lisp/epg.el b/lisp/epg.el index 920b85398f3..b27e2c638c2 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -1382,6 +1382,13 @@ NAME is either a string or a list of strings." (setq pointer (cdr pointer))) keys)) +(defun epg--filter-revoked-keys (keys) + (seq-remove (lambda (key) + (seq-find (lambda (user) + (eq (epg-user-id-validity user) 'revoked)) + (epg-key-user-id-list key))) + keys)) + (defun epg--args-from-sig-notations (notations) (apply #'nconc (mapcar