mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-01 08:17:38 +00:00
2006-03-21 Simon Josefsson <jas@extundo.com>
* pgg-gpg.el: Ideas below based on patch from Sascha Wilde <wilde@sha-bang.de>. (pgg-gpg-use-agent): New variable. (pgg-gpg-process-region): Use it. (pgg-gpg-encrypt-region): Likewise. (pgg-gpg-encrypt-symmetric-region): Likewise. (pgg-gpg-decrypt-region): Likewise. (pgg-gpg-sign-region): Likewise. (pgg-gpg-possibly-cache-passphrase): Don't cache a nil password.
This commit is contained in:
parent
c0434d3b46
commit
e563e53b5c
@ -1,3 +1,15 @@
|
||||
2006-03-21 Simon Josefsson <jas@extundo.com>
|
||||
|
||||
* pgg-gpg.el: Ideas below based on patch from Sascha Wilde
|
||||
<wilde@sha-bang.de>.
|
||||
(pgg-gpg-use-agent): New variable.
|
||||
(pgg-gpg-process-region): Use it.
|
||||
(pgg-gpg-encrypt-region): Likewise.
|
||||
(pgg-gpg-encrypt-symmetric-region): Likewise.
|
||||
(pgg-gpg-decrypt-region): Likewise.
|
||||
(pgg-gpg-sign-region): Likewise.
|
||||
(pgg-gpg-possibly-cache-passphrase): Don't cache a nil password.
|
||||
|
||||
2006-03-21 Carsten Dominik <dominik@science.uva.nl>
|
||||
|
||||
* textmodes/org.el: (org-open-at-point): Fixed bug in wiki-style
|
||||
|
@ -51,6 +51,13 @@
|
||||
:type '(choice (const :tag "New `--recipient' option" "--recipient")
|
||||
(const :tag "Old `--remote-user' option" "--remote-user")))
|
||||
|
||||
(defcustom pgg-gpg-use-agent (if (getenv "GPG_AGENT_INFO") t nil)
|
||||
"Whether to use gnupg agent for key caching.
|
||||
By default, it will be enabled iff the environment variable
|
||||
\"GPG_AGENT_INFO\" is set."
|
||||
:group 'pgg-gpg
|
||||
:type 'boolean)
|
||||
|
||||
(defvar pgg-gpg-user-id nil
|
||||
"GnuPG ID of your default identity.")
|
||||
|
||||
@ -58,7 +65,8 @@
|
||||
(let* ((output-file-name (pgg-make-temp-file "pgg-output"))
|
||||
(args
|
||||
`("--status-fd" "2"
|
||||
,@(if passphrase '("--passphrase-fd" "0"))
|
||||
,@(if pgg-gpg-use-agent '("--use-agent")
|
||||
(if passphrase '("--passphrase-fd" "0")))
|
||||
"--yes" ; overwrite
|
||||
"--output" ,output-file-name
|
||||
,@pgg-gpg-extra-args ,@args))
|
||||
@ -100,7 +108,8 @@
|
||||
(set-default-file-modes orig-mode))))
|
||||
|
||||
(defun pgg-gpg-possibly-cache-passphrase (passphrase &optional key notruncate)
|
||||
(if (and pgg-cache-passphrase
|
||||
(if (and passphrase
|
||||
pgg-cache-passphrase
|
||||
(progn
|
||||
(goto-char (point-min))
|
||||
(re-search-forward "^\\[GNUPG:] \\(GOOD_PASSPHRASE\\>\\)\\|\\(SIG_CREATED\\)" nil t)))
|
||||
@ -182,11 +191,11 @@ If optional PASSPHRASE is not specified, it will be obtained from the
|
||||
passphrase cache or user."
|
||||
(let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id))
|
||||
(passphrase (or passphrase
|
||||
(when sign
|
||||
(pgg-read-passphrase
|
||||
(format "GnuPG passphrase for %s: "
|
||||
pgg-gpg-user-id)
|
||||
pgg-gpg-user-id))))
|
||||
(when (and sign (not pgg-gpg-use-agent))
|
||||
(pgg-read-passphrase
|
||||
(format "GnuPG passphrase for %s: "
|
||||
pgg-gpg-user-id)
|
||||
pgg-gpg-user-id))))
|
||||
(args
|
||||
(append
|
||||
(list "--batch" "--armor" "--always-trust" "--encrypt")
|
||||
@ -214,8 +223,9 @@ passphrase cache or user."
|
||||
If optional PASSPHRASE is not specified, it will be obtained from the
|
||||
passphrase cache or user."
|
||||
(let* ((passphrase (or passphrase
|
||||
(pgg-read-passphrase
|
||||
"GnuPG passphrase for symmetric encryption: ")))
|
||||
(when (not pgg-gpg-use-agent)
|
||||
(pgg-read-passphrase
|
||||
"GnuPG passphrase for symmetric encryption: "))))
|
||||
(args
|
||||
(append (list "--batch" "--armor" "--symmetric" )
|
||||
(if pgg-text-mode (list "--textmode")))))
|
||||
@ -242,12 +252,13 @@ passphrase cache or user."
|
||||
(pgg-gpg-user-id (or key-id key
|
||||
pgg-gpg-user-id pgg-default-user-id))
|
||||
(passphrase (or passphrase
|
||||
(pgg-read-passphrase
|
||||
(format (if (pgg-gpg-symmetric-key-p message-keys)
|
||||
"Passphrase for symmetric decryption: "
|
||||
"GnuPG passphrase for %s: ")
|
||||
(or key-owner "??"))
|
||||
pgg-gpg-user-id)))
|
||||
(when (not pgg-gpg-use-agent)
|
||||
(pgg-read-passphrase
|
||||
(format (if (pgg-gpg-symmetric-key-p message-keys)
|
||||
"Passphrase for symmetric decryption: "
|
||||
"GnuPG passphrase for %s: ")
|
||||
(or key-owner "??"))
|
||||
pgg-gpg-user-id))))
|
||||
(args '("--batch" "--decrypt")))
|
||||
(pgg-gpg-process-region start end passphrase pgg-gpg-program args)
|
||||
(with-current-buffer pgg-errors-buffer
|
||||
@ -277,9 +288,11 @@ passphrase cache or user."
|
||||
"Make detached signature from text between START and END."
|
||||
(let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id))
|
||||
(passphrase (or passphrase
|
||||
(pgg-read-passphrase
|
||||
(format "GnuPG passphrase for %s: " pgg-gpg-user-id)
|
||||
pgg-gpg-user-id)))
|
||||
(when (not pgg-gpg-use-agent)
|
||||
(pgg-read-passphrase
|
||||
(format "GnuPG passphrase for %s: "
|
||||
pgg-gpg-user-id)
|
||||
pgg-gpg-user-id))))
|
||||
(args
|
||||
(append (list (if cleartext "--clearsign" "--detach-sign")
|
||||
"--armor" "--batch" "--verbose"
|
||||
|
Loading…
Reference in New Issue
Block a user