:type 'boolean
:group 'epa-file)
+(defcustom epa-file-select-keys nil
+ "If non-nil, always asks user to select recipients."
+ :type 'boolean
+ :group 'epa-file)
+
(defvar epa-file-encrypt-to nil
"*Recipient(s) used for encrypting files.
May either be a string or a list of strings.")
(defvar epa-file-passphrase-alist nil)
-(if (fboundp 'encode-coding-string)
- (defalias 'epa-file--encode-coding-string 'encode-coding-string)
- (defalias 'epa-file--encode-coding-string 'identity))
+(eval-and-compile
+ (if (fboundp 'encode-coding-string)
+ (defalias 'epa-file--encode-coding-string 'encode-coding-string)
+ (defalias 'epa-file--encode-coding-string 'identity)))
-(if (fboundp 'decode-coding-string)
- (defalias 'epa-file--decode-coding-string 'decode-coding-string)
- (defalias 'epa-file--decode-coding-string 'identity))
+(eval-and-compile
+ (if (fboundp 'decode-coding-string)
+ (defalias 'epa-file--decode-coding-string 'decode-coding-string)
+ (defalias 'epa-file--decode-coding-string 'identity)))
(defun epa-file-name-regexp-update ()
(interactive)
file))
(epg-context-set-progress-callback context
#'epa-progress-callback-function)
+ (epg-context-set-armor context epa-armor)
+ (epg-context-set-textmode context epa-textmode)
(condition-case error
(setq string
(epg-encrypt-string
(epa-file--encode-coding-string start coding-system)
(epa-file--encode-coding-string (buffer-substring start end)
coding-system))
- (if (local-variable-p 'epa-file-encrypt-to)
- (if epa-file-encrypt-to
- (epg-list-keys context recipients))
- (epa-select-keys
- context
- "Select recipents for encryption.
+ (if (or epa-file-select-keys
+ (not (local-variable-p 'epa-file-encrypt-to)))
+ (epa-select-keys
+ context
+ "Select recipents for encryption.
If no one is selected, symmetric encryption will be performed. "
- recipients))))
+ recipients)
+ (if epa-file-encrypt-to
+ (epg-list-keys context recipients)))))
(error
(if (setq entry (assoc file epa-file-passphrase-alist))
(setcdr entry nil))
epa-file-inhibit-auto-save)
(auto-save-mode 0)))
+(defun epa-file-select-keys ()
+ "Select recipients for encryption."
+ (interactive)
+ (make-local-variable 'epa-file-encrypt-to)
+ (setq epa-file-encrypt-to
+ (epa-select-keys
+ (epg-make-context)
+ "Select recipents for encryption.
+If no one is selected, symmetric encryption will be performed. ")))
+
;;;###autoload
(defun epa-file-enable ()
(interactive)