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.
This commit is contained in:
Lars Ingebrigtsen 2020-12-09 13:17:06 +01:00
parent c50c0a19e3
commit 45630ca6c8
2 changed files with 9 additions and 1 deletions

View file

@ -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))

View file

@ -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