]> git.eshelyaron.com Git - emacs.git/commitdiff
Filter revoked keys when saving files
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 9 Dec 2020 12:17:06 +0000 (13:17 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 9 Dec 2020 12:17:25 +0000 (13:17 +0100)
* 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.

lisp/epa-file.el
lisp/epg.el

index 7fd4178474616dcfb9af1f36d0fd785188dd1d84..21dc1ebaff0e8cb28277385d1f0a528e03372654 100644 (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))
index 920b85398f391ad05afa6ed5957f350fbeb6a2a4..b27e2c638c277b52bd10a693335215f42bb70476 100644 (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