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