(interactive)
(let ((file-list (dired-get-marked-files)))
(while file-list
- (epa-sign-file (expand-file-name (car file-list))
- (y-or-n-p "Make a detached signature? "))
+ (epa-sign-file
+ (expand-file-name (car file-list))
+ (epa-select-keys (epg-make-context) "Select keys for signing.
+If no one is selected, default secret key is used. "
+ nil t)
+ (y-or-n-p "Make a detached signature? "))
(setq file-list (cdr file-list)))
(revert-buffer)))
(epg-verify-result-to-string
(epg-context-result-for context 'verify)))))
-(defun epa-sign-file (file detached)
+(defun epa-sign-file (file signers detached)
(interactive
(list (expand-file-name (read-file-name "File: "))
+ (epa-select-keys (epg-make-context) "Select keys for signing.
+If no one is selected, default secret key is used. "
+ nil t)
(y-or-n-p "Make a detached signature? ")))
(let ((signature (concat file (if detached ".sig" ".gpg")))
(context (epg-make-context)))
(message "Signing %s..." (file-name-nondirectory file))
+ (epg-context-set-signers context signers)
(epg-sign-file context file signature (not (null detached)))
(message "Signing %s...done" (file-name-nondirectory file))))