;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
"A minor-mode for composing encrypted/clearsigned mails."
nil " epa-mail" epa-mail-mode-map)
+(defun epa-mail--find-usable-key (keys usage)
+ "Find a usable key from KEYS for USAGE."
+ (let ((pointer (epg-key-sub-key-list (car keys))))
+ (if (and (memq usage (epg-sub-key-capability (car pointer)))
+ (not (memq (epg-sub-key-validity (car pointer))
+ (throw 'found (car keys)))
+ (setq pointer (cdr pointer))))
+ (setq keys (cdr keys)))))
(defun epa-mail-decrypt ()
"Decrypt OpenPGP armors in the current buffer.
(let ((verbose current-prefix-arg)
(context (epg-make-context epa-protocol))
- recipients recipient-key
+ recipients recipient-key)
If no one is selected, symmetric encryption will be performed. "
- (epg-make-context epa-protocol)
- (concat "<" recipient ">")))
- (unless (or recipient-keys
- "No public key for %s; skip it? "
- (error "No public key for %s" recipient))
+ (epg-make-context epa-protocol)
+ (concat "<" recipient ">"))
+ (unless (or recipient-key
+ "No public key for %s; skip it? "
+ (error "No public key for %s" recipient))
(setq sign (if verbose (y-or-n-p "Sign? ")))