From: ueno Date: Thu, 11 May 2006 05:56:38 +0000 (+0000) Subject: * epa.el (epa-armor): New user option. X-Git-Tag: epg-0_0_2~41 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39092c19cffe1d4367173507e2cc70026f3e0663;p=elisp%2Fepg.git * epa.el (epa-armor): New user option. (epa-textmode): New user option. --- diff --git a/ChangeLog b/ChangeLog index 59c86cb..62d8d7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-11 Daiki Ueno + + * epa.el (epa-armor): New user option. + (epa-textmode): New user option. + 2006-05-02 Daiki Ueno * epg.el (epg-make-key-signature): New object epg-key-signature. diff --git a/epa-file.el b/epa-file.el index 29611b9..b2466d9 100644 --- a/epa-file.el +++ b/epa-file.el @@ -137,9 +137,9 @@ (encode-coding-string (buffer-substring start end) coding-system)) (unless (assoc file epa-file-passphrase-alist) - (epa-select-keys - context - "Select recipents for encryption. + (epa-select-keys + context + "Select recipents for encryption. If no one is selected, symmetric encryption will be performed. ")))) (error (if (setq entry (assoc file epa-file-passphrase-alist)) diff --git a/epa.el b/epa.el index 57dfca2..703e056 100644 --- a/epa.el +++ b/epa.el @@ -32,6 +32,16 @@ "The EasyPG Assistant" :group 'epg) +(defcustom epa-armor nil + "If non-nil, epa commands create ASCII armored output." + :type 'boolean + :group 'epa) + +(defcustom epa-textmode nil + "If non-nil, epa commands treat input files as text." + :type 'boolean + :group 'epa) + (defgroup epa-faces nil "Faces for epa-mode." :group 'epa) @@ -501,8 +511,14 @@ If DETACHED is non-nil, it creates a detached signature." 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"))) + (let ((signature (concat file (if epa-armor + ".asc" + (if detached + ".sig" + ".gpg")))) (context (epg-make-context))) + (epg-context-set-armor context epa-armor) + (epg-context-set-textmode context epa-textmode) (message "Signing %s..." (file-name-nondirectory file)) (epg-context-set-signers context signers) (epg-sign-file context file signature (not (null detached))) @@ -515,8 +531,10 @@ If no one is selected, default secret key is used. " (list (expand-file-name (read-file-name "File: ")) (epa-select-keys (epg-make-context) "Select recipents for encryption. If no one is selected, symmetric encryption will be performed. "))) - (let ((cipher (concat file ".gpg")) + (let ((cipher (concat file (if epa-armor ".asc" ".gpg"))) (context (epg-make-context))) + (epg-context-set-armor context epa-armor) + (epg-context-set-textmode context epa-textmode) (message "Encrypting %s..." (file-name-nondirectory file)) (epg-encrypt-file context file recipients cipher) (message "Encrypting %s...done" (file-name-nondirectory file)))) @@ -557,7 +575,7 @@ If no one is selected, symmetric encryption will be performed. "))) (setq default-name (expand-file-name (concat (epg-sub-key-id (car (epg-key-sub-key-list (car keys)))) - ".gpg") + (if epa-armor ".asc" ".gpg")) default-directory)) (list keys (expand-file-name @@ -568,6 +586,7 @@ If no one is selected, symmetric encryption will be performed. "))) (file-name-directory default-name) default-name))))) (let ((context (epg-make-context))) + (epg-context-set-armor context epa-armor) (message "Exporting to %s..." (file-name-nondirectory file)) (epg-export-keys-to-file context keys file) (message "Exporting to %s...done" (file-name-nondirectory file))))