(epa-sign-region start end signers mode))
;;;###autoload
-(defun epa-encrypt-region (start end recipients)
+(defun epa-encrypt-region (start end recipients sign signers)
"Encrypt the current region between START and END for RECIPIENTS.
Don't use this command in Lisp programs!"
(interactive
- (progn
+ (let ((sign (if current-prefix-arg (y-or-n-p "Sign? ")))
+ (context (epg-make-context epa-protocol))
+ sign)
(setq epa-last-coding-system-specified
(or coding-system-for-write
(epa--select-safe-coding-system
(region-beginning) (region-end))))
(list (region-beginning) (region-end)
- (epa-select-keys (epg-make-context epa-protocol)
+ (epa-select-keys context
"Select recipients for encryption.
-If no one is selected, symmetric encryption will be performed. "))))
+If no one is selected, symmetric encryption will be performed. ")
+ sign
+ (if sign
+ (epa-select-keys context
+ "Select keys for signing. ")))))
(save-excursion
(let ((context (epg-make-context epa-protocol))
cipher)
(epg-context-set-armor context t)
;;(epg-context-set-textmode context epa-textmode)
(epg-context-set-textmode context t)
+ (if sign
+ (epg-context-set-signers context signers))
(epg-context-set-passphrase-callback context
#'epa-passphrase-callback-function)
(epg-context-set-progress-callback context
'end-open t)))))
;;;###autoload
-(defun epa-encrypt (start end recipients)
+(defun epa-encrypt (start end recipients sign signers)
"Encrypt the current buffer.
Don't use this command in Lisp programs!"
(interactive
(save-excursion
- (let (recipients)
+ (let* ((verbose current-prefix-arg)
+ (sign (if verbose (y-or-n-p "Sign? ")))
+ (context (epg-make-context epa-protocol))
+ recipients)
(goto-char (point-min))
(when (epa--mail-mode-p)
(save-restriction
(or coding-system-for-write
(epa--select-safe-coding-system (point) (point-max))))
(list (point) (point-max)
- (if current-prefix-arg
+ (if verbose
(epa-select-keys
- (epg-make-context epa-protocol)
+ context
"Select recipients for encryption.
If no one is selected, symmetric encryption will be performed. "
recipients)
(epg-list-keys
(epg-make-context epa-protocol)
(concat "<" recipient ">")))
- recipients)))))))))
- (epa-encrypt-region start end recipients))
+ recipients)))))
+ sign
+ (if sign
+ (epa-select-keys context
+ "Select keys for signing. "))))))
+ (epa-encrypt-region start end recipients sign signers))
;;;###autoload
(defun epa-delete-keys (keys &optional allow-secret)