From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/62571 Path: news.gmane.org!not-for-mail From: Daiki Ueno Newsgroups: gmane.emacs.gnus.general Subject: PGG updates Date: Fri, 07 Apr 2006 17:09:40 +0900 Message-ID: <5451ce4a-1627-439f-9cba-308911539eae@well-done.deisui.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Fri_Apr__7_17:09:40_2006-1" X-Trace: sea.gmane.org 1144397636 21278 80.91.229.2 (7 Apr 2006 08:13:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 7 Apr 2006 08:13:56 +0000 (UTC) Cc: ding@gnus.org Original-X-From: ding-owner+m11098@lists.math.uh.edu Fri Apr 07 10:13:54 2006 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FRm6C-0004rD-NS for ding-account@gmane.org; Fri, 07 Apr 2006 10:13:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1FRm62-0002z0-00; Fri, 07 Apr 2006 03:13:34 -0500 Original-Received: from nas01.math.uh.edu ([129.7.128.39]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1FRm2T-0002yt-00 for ding@lists.math.uh.edu; Fri, 07 Apr 2006 03:09:53 -0500 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas01.math.uh.edu with esmtp (Exim 4.52) id 1FRm2Q-0006CW-7B for ding@lists.math.uh.edu; Fri, 07 Apr 2006 03:09:53 -0500 Original-Received: from g96069.scn-net.ne.jp ([210.231.96.69] helo=well-done.deisui.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1FRm2N-0004X3-00 for ; Fri, 07 Apr 2006 10:09:48 +0200 Original-Received: from [150.82.173.221] (helo=well-done.deisui.org) by well-done.deisui.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1FRm2J-0003vd-Ls; Fri, 07 Apr 2006 17:09:43 +0900 Original-To: Simon Josefsson X-Attribution: DU User-Agent: T-gnus/6.17.2 (based on No Gnus v0.2) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.4 (patch 17) (Jumbo Shrimp) (i686-pc-linux) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin (3.1.0 2005-09-13) analysis follows Bayesian score: 0.0000 Ham tokens: 0.000-1010--4092h-0s--0d--H*u:Gnus, 0.000-1010--4092h-0s--0d--H*UA:Gnus, 0.000-814--3299h-0s--0d--H*UA:21.4, 0.000-690--2794h-0s--0d--H*u:21.4, 0.000-381--1542h-0s--0d--H*UA:XEmacs Spam tokens: 0.934-1316--843h-16071s--0d--H*r:quimby.gnus.org, 0.915-1141--1202h-17441s--0d--H*r:3.35, 0.912-2971--3393h-47371s--0d--H*c:HHHH, 0.908-526--663h-8844s--0d--H*r:ding@gnus.org, 0.894-763--1433h-16342s--0d--H*RU:80.91.224.244 Autolearn status: no 0.1 FORGED_RCVD_HELO Received: contains a forged HELO -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] 3.9 RCVD_IN_XBL RBL: Received via a relay in Spamhaus XBL [210.231.96.69 listed in sbl-xbl.spamhaus.org] -1.4 AWL AWL: From: address is in the auto white-list Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:62571 Archived-At: --Multipart_Fri_Apr__7_17:09:40_2006-1 Content-Type: text/plain; charset=US-ASCII Patch from Gnus' trunk is attached. Major changes are listed below. * Changed pgg-gpg-decrypt-region to write out an encrypted armor to a file. This should fix the problem Sacsha reported. * Added new interface function pgg-list-keys. This function returns more information about keys than pgg-lookup-key. For example: (pgg-list-keys "ueno") => (((pub (trust . "u") (length . 1024) (algorithm . 17) (key-id . "A5B6B2D4B15813FE") (creation-date . "1002618643") (expiration-date . "1155189267") (ownertrust . "u") (capability . "scESC")) (uid (trust . "u") (creation-date . "1060581267") (hash . "461300972A811B7CDF6EE9ED3E918AD940E4F384") (user-id . "Daiki Ueno ")))) * Added some notes in comments/docstrings of backend functions to prevent direct usage. * pgg-gpg-recipient-argument is abolished, because "-r" has the same meaning as "--remote-user" and "--recipient". --Multipart_Fri_Apr__7_17:09:40_2006-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="pgg-gpg.el.diff" Content-Transfer-Encoding: 7bit Index: lisp/pgg-gpg.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/pgg-gpg.el,v retrieving revision 7.22 diff -u -r7.22 pgg-gpg.el --- lisp/pgg-gpg.el 5 Apr 2006 12:57:22 -0000 7.22 +++ lisp/pgg-gpg.el 7 Apr 2006 08:07:26 -0000 @@ -25,6 +25,11 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. +;;; Commentary: + +;; NOTE: This file is a backend of pgg.el. Please do not directly +;; call functions defined in this file from your program. + ;;; Code: (eval-when-compile @@ -44,12 +49,6 @@ :group 'pgg-gpg :type '(repeat (string :tag "Argument"))) -(defcustom pgg-gpg-recipient-argument "--recipient" - "GnuPG option to specify recipient." - :group 'pgg-gpg - :type '(choice (const :tag "New `--recipient' option" "--recipient") - (const :tag "Old `--remote-user' option" "--remote-user"))) - (defcustom pgg-gpg-use-agent nil "Whether to use gnupg agent for key caching." :group 'pgg-gpg @@ -62,20 +61,56 @@ "An alist mapping from key ID to user ID.") (defvar pgg-gpg-read-point nil) -(defvar pgg-gpg-output-file-name nil) (defvar pgg-gpg-pending-status-list nil) (defvar pgg-gpg-key-id nil) (defvar pgg-gpg-passphrase nil) (defvar pgg-gpg-debug nil) +(defvar pgg-gpg-colons-pub-spec + '((trust "[^:]") + (length "[0-9]+" 0 string-to-number) + (algorithm "[0-9]+" 0 string-to-number) + (key-id "[^:]+") + (creation-date "[0-9]+") + (expiration-date "[0-9]+") + nil + (ownertrust "[^:]") + nil + nil + (capability "[escaESCA]*"))) + +(defvar pgg-gpg-colons-sec-spec + '((trust "[^:]") + (length "[0-9]+" 0 string-to-number) + (algorithm "[0-9]+" 0 string-to-number) + (key-id "[^:]+") + (creation-date "[0-9]+") + (expiration-date "[0-9]+") + nil + (ownertrust "[^:]"))) + +(defvar pgg-gpg-colons-uid-spec + '((trust "[^:]") + nil + nil + nil + (creation-date "[0-9]+") + (expiration-date "[0-9]+") + (hash "[^:]+") + nil + (user-id "[^:]+"))) + (defun pgg-gpg-start-process (args) - (let* ((output-file-name (pgg-make-temp-file "pgg-output")) - (args + "This function is for internal use only. + +Start pgg-gpg-program in a subprocess with given ARGS. +Return the process object for it." + (let* ((args (append (list "--no-tty" "--status-fd" "1" "--command-fd" "0" "--yes" ; overwrite - "--output" output-file-name) + ) (if pgg-gpg-use-agent '("--use-agent")) pgg-gpg-extra-args args)) @@ -87,8 +122,6 @@ (with-current-buffer buffer (make-local-variable 'pgg-gpg-read-point) (setq pgg-gpg-read-point (point-min)) - (make-local-variable 'pgg-gpg-output-file-name) - (setq pgg-gpg-output-file-name output-file-name) (make-local-variable 'pgg-gpg-pending-status-list) (setq pgg-gpg-pending-status-list nil) (make-local-variable 'pgg-gpg-key-id) @@ -145,22 +178,17 @@ (set-buffer (get-buffer-create pgg-errors-buffer)) (buffer-disable-undo) (erase-buffer) - (insert-buffer-substring (process-buffer process)) - ;; Read the contents of the output file to pgg-output-buffer. - (set-buffer (get-buffer-create pgg-output-buffer)) - (buffer-disable-undo) - (erase-buffer) - (if (equal status "finished\n") - (let ((output-file-name - (with-current-buffer (process-buffer process) - pgg-gpg-output-file-name))) - (when (file-exists-p output-file-name) - (let ((coding-system-for-read (if pgg-text-mode - 'raw-text - 'binary))) - (insert-file-contents output-file-name)) - (delete-file output-file-name)))) - (kill-buffer (process-buffer process))))) + (insert-buffer-substring (process-buffer process))))) + +(defun pgg-gpg-read-output-file (output-file-name) + (set-buffer (get-buffer-create pgg-output-buffer)) + (buffer-disable-undo) + (erase-buffer) + (if (file-exists-p output-file-name) + (let ((coding-system-for-read (if pgg-text-mode + 'raw-text + 'binary))) + (insert-file-contents output-file-name)))) (defun pgg-gpg-wait-for-status (process status-list) (with-current-buffer (process-buffer process) @@ -224,7 +252,9 @@ (setq pgg-gpg-passphrase nil))) (defun pgg-gpg-lookup-key (string &optional type) - "Search keys associated with STRING." + "This function is for internal use only. + +Search keys associated with STRING." (let ((args (list "--with-colons" "--no-greeting" "--batch" (if type "--list-secret-keys" "--list-keys") string))) @@ -235,117 +265,304 @@ nil t) (substring (match-string 2) 8))))) +(defun pgg-gpg-list-keys (name &optional secret) + "This function is for internal use only. + +Search keys associated with STRING." + (let ((args (list "--with-colons" "--no-greeting" "--batch" + "--fixed-list-mode" + (if secret "--list-secret-keys" "--list-keys") + name)) + keys + type + symbol + pointer) + (with-temp-buffer + (apply #'call-process pgg-gpg-program nil (list t nil) nil args) + (goto-char (point-min)) + (while (looking-at "\\([a-z][a-z][a-z]\\):\\(.*\\)") + (setq type (match-string 1) + symbol (intern-soft (format "pgg-gpg-colons-%s-spec" type))) + (if (member type '("pub" "sec")) + (setq keys (cons nil keys))) + (if (and symbol + (boundp symbol)) + (setcar keys (cons (cons (intern type) + (pgg-gpg-parse-colons + (symbol-value symbol) + (match-string 2))) + (car keys)))) + (forward-line))) + (setq pointer keys) + (while pointer + (setcar pointer (nreverse (car pointer))) + (setq pointer (cdr pointer))) + (nreverse keys))) + +(defun pgg-gpg-parse-colons (alist string) + (let ((index 0) + result) + (while (and alist + (or (null (car alist)) + (eq index + (string-match + (concat "\\(" (nth 1 (car alist)) "\\)?:") + string index)))) + (if (car alist) + (progn + (setq index (match-end 0)) + (if (match-beginning 1) + (setq result (cons (cons (car (car alist)) + (funcall + (or (nth 3 (car alist)) #'identity) + (match-string + (1+ (or (nth 2 (car alist)) 0)) + string))) + result)))) + (setq index (1+ index))) + (setq alist (cdr alist))) + (nreverse result))) + (defun pgg-gpg-encrypt-region (start end recipients &optional sign passphrase) - "Encrypt the current region between START and END. + "This function is for internal use only. + +Encrypt the current region between START and END. -If optional argument SIGN is non-nil, do a combined sign and encrypt." +If optional argument SIGN is non-nil, do a combined sign and encrypt. + +Obsolete feature: 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)) + (output-file-name (pgg-make-temp-file "pgg-output")) (args (append - '("--armor" "--always-trust" "--encrypt") + (list "--armor" "--always-trust" "--encrypt" + "--output" output-file-name) + (if passphrase '("--passphrase-fd" "0")) (if pgg-text-mode '("--textmode")) (if sign (list "--sign" "--local-user" pgg-gpg-user-id)) (if recipients (apply #'nconc (mapcar (lambda (rcpt) - (list pgg-gpg-recipient-argument rcpt)) - (append recipients - (if pgg-encrypt-for-me - (list pgg-gpg-user-id)))))))) - (process (pgg-gpg-start-process args))) - (if (and sign (not pgg-gpg-use-agent)) - (pgg-gpg-wait-for-status process '("BEGIN_SIGNING" "GOOD_PASSPHRASE"))) - (process-send-region process start end) - (pgg-gpg-wait-for-completion process) - (save-excursion - (set-buffer (get-buffer-create pgg-errors-buffer)) - (goto-char (point-max)) - (not (null (re-search-backward "^\\[GNUPG:] END_ENCRYPTION\\>" - nil t)))))) + (list "-r" rcpt)) + (if pgg-encrypt-for-me + (cons pgg-gpg-user-id recipients) + recipients)))))) + process status) + (unwind-protect + (progn + (setq process (pgg-gpg-start-process args)) + (if (and passphrase + (eq (process-status process) 'run)) + (process-send-string process (concat passphrase "\n"))) + (if (and sign (not pgg-gpg-use-agent)) + (pgg-gpg-wait-for-status process + '("BEGIN_SIGNING" "GOOD_PASSPHRASE"))) + (if (eq (process-status process) 'run) + (process-send-region process start end)) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer pgg-errors-buffer)) + (goto-char (point-max)) + (setq status (not (null (re-search-backward + "^\\[GNUPG:] END_ENCRYPTION\\>" + nil t))))) + (if status + (pgg-gpg-read-output-file output-file-name)) + status) + (if (and process (buffer-live-p (process-buffer process))) + (kill-buffer (process-buffer process))) + (if (file-exists-p output-file-name) + (delete-file output-file-name))))) (defun pgg-gpg-encrypt-symmetric-region (start end &optional passphrase) - "Encrypt the current region between START and END with symmetric cipher." - (let* ((args - (append '("--armor" "--symmetric") + "This function is for internal use only. + +Encrypt the current region between START and END with symmetric cipher. + +If optional PASSPHRASE is not specified, it will be +obtained from the passphrase cache or user." + (let* ((output-file-name (pgg-make-temp-file "pgg-output")) + (args + (append (list "--armor" "--symmetric" + "--output" output-file-name) + (if passphrase '("--passphrase-fd" "0")) (if pgg-text-mode '("--textmode")))) - (process (pgg-gpg-start-process args))) - (pgg-gpg-wait-for-status process '("BEGIN_ENCRYPTION")) - (process-send-region process start end) - (pgg-gpg-wait-for-completion process) - (save-excursion - (set-buffer (get-buffer-create pgg-errors-buffer)) - (goto-char (point-max)) - (not (null (re-search-backward "^\\[GNUPG:] END_ENCRYPTION\\>" - nil t)))))) + process status) + (unwind-protect + (progn + (setq process (pgg-gpg-start-process args)) + (if (and passphrase + (eq (process-status process) 'run)) + (process-send-string process (concat passphrase "\n"))) + (pgg-gpg-wait-for-status process '("BEGIN_ENCRYPTION")) + (if (eq (process-status process) 'run) + (process-send-region process start end)) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer pgg-errors-buffer)) + (goto-char (point-max)) + (setq status (not (null (re-search-backward + "^\\[GNUPG:] END_ENCRYPTION\\>" + nil t))))) + (if status + (pgg-gpg-read-output-file output-file-name)) + status) + (if (and process (buffer-live-p (process-buffer process))) + (kill-buffer (process-buffer process))) + (if (file-exists-p output-file-name) + (delete-file output-file-name))))) (defun pgg-gpg-decrypt-region (start end &optional passphrase) - "Decrypt the current region between START and END." - (let* ((args '("--decrypt")) - (process (pgg-gpg-start-process args))) - (process-send-region process start end) - (pgg-gpg-wait-for-status process '("BEGIN_DECRYPTION")) - (pgg-gpg-wait-for-completion process) - (save-excursion - (set-buffer (get-buffer-create pgg-errors-buffer)) - (goto-char (point-max)) - (not (null (re-search-backward "^\\[GNUPG:] DECRYPTION_OKAY\\>" - nil t)))))) + "This function is for internal use only. + +Decrypt the current region between START and END. + +Obsolete feature: if optional PASSPHRASE is not specified, it will be +obtained from the passphrase cache or user." + (let* ((input-file-name (pgg-make-temp-file "pgg-input")) + (output-file-name (pgg-make-temp-file "pgg-output")) + (args (append + (list "--decrypt" "--output" output-file-name input-file-name) + (if passphrase '("--passphrase-fd" "0")))) + process status) + (unwind-protect + (progn + (write-region start end input-file-name) + (setq process (pgg-gpg-start-process args)) + (if (and passphrase + (eq (process-status process) 'run)) + (process-send-string process (concat passphrase "\n"))) + (pgg-gpg-wait-for-status process '("BEGIN_DECRYPTION")) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (setq status (not (null (re-search-backward + "^\\[GNUPG:] DECRYPTION_OKAY\\>" + nil t))))) + (if status + (pgg-gpg-read-output-file output-file-name)) + status) + (if (and process (buffer-live-p (process-buffer process))) + (kill-buffer (process-buffer process))) + (if (file-exists-p input-file-name) + (delete-file input-file-name)) + (if (file-exists-p output-file-name) + (delete-file output-file-name))))) (defun pgg-gpg-sign-region (start end &optional cleartext passphrase) - "Make detached signature from text between START and END." - (let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) + "This function is for internal use only. + +Make detached signature from text between START and END. + +Obsolete feature: if optional PASSPHRASE is not specified, it will be +obtained from the passphrase cache or user." + (let* ((output-file-name (pgg-make-temp-file "pgg-output")) + (pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) (args (append (list (if cleartext "--clearsign" "--detach-sign") "--armor" "--verbose" - "--local-user" pgg-gpg-user-id) + "--local-user" pgg-gpg-user-id + "--output" output-file-name) + (if passphrase '("--passphrase-fd" "0")) (if pgg-text-mode '("--textmode")))) - (process (pgg-gpg-start-process args))) - (unless pgg-gpg-use-agent - (pgg-gpg-wait-for-status process '("BEGIN_SIGNING" "GOOD_PASSPHRASE"))) - (process-send-region process start end) - (pgg-gpg-wait-for-completion process) - (save-excursion - (set-buffer (get-buffer-create pgg-errors-buffer)) - (goto-char (point-max)) - (not (null (re-search-backward "^\\[GNUPG:] SIG_CREATED\\>" - nil t)))))) + process status) + (unwind-protect + (progn + (setq process (pgg-gpg-start-process args)) + (if (and passphrase + (eq (process-status process) 'run)) + (process-send-string process (concat passphrase "\n"))) + (unless pgg-gpg-use-agent + (pgg-gpg-wait-for-status process + '("BEGIN_SIGNING" "GOOD_PASSPHRASE"))) + (if (eq (process-status process) 'run) + (process-send-region process start end)) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (setq status (not (null (re-search-backward + "^\\[GNUPG:] SIG_CREATED\\>" + nil t))))) + (if status + (pgg-gpg-read-output-file output-file-name)) + status) + (if (and process (buffer-live-p (process-buffer process))) + (kill-buffer (process-buffer process))) + (if (file-exists-p output-file-name) + (delete-file output-file-name))))) (defun pgg-gpg-verify-region (start end &optional signature) - "Verify region between START and END as the detached signature SIGNATURE." - (let ((args '("--verify")) - process) - (when (stringp signature) - (setq args (append args (list signature)))) - (setq process (pgg-gpg-start-process (append args '("-")))) - (process-send-region process start end) - (pgg-gpg-wait-for-completion process) - (save-excursion - (set-buffer (get-buffer-create pgg-errors-buffer)) - (goto-char (point-max)) - (not (null (re-search-backward "^\\[GNUPG:] GOODSIG\\>" - nil t)))))) + "This function is for internal use only. + +Verify region between START and END as the detached signature SIGNATURE." + (let* ((output-file-name (pgg-make-temp-file "pgg-output")) + (args (list "--verify" "--output" output-file-name)) + process status) + (if signature + (setq args (append args (list signature)))) + (unwind-protect + (progn + (setq process (pgg-gpg-start-process (append args '("-")))) + (if (eq (process-status process) 'run) + (process-send-region process start end)) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (setq status (not (null (re-search-backward + "^\\[GNUPG:] GOODSIG\\>" + nil t))))) + (if status + (pgg-gpg-read-output-file output-file-name)) + status) + (if (and process (buffer-live-p (process-buffer process))) + (kill-buffer (process-buffer process))) + (if (file-exists-p output-file-name) + (delete-file output-file-name))))) (defun pgg-gpg-insert-key () - "Insert public key at point." + "This function is for internal use only. + +Insert public key at point." (let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) - (args (list "--export" "--armor" + (output-file-name (pgg-make-temp-file "pgg-output")) + (args (list "--export" "--armor" "--output" output-file-name pgg-gpg-user-id)) - (process (pgg-gpg-start-process args))) - (pgg-gpg-wait-for-completion process) - (insert-buffer-substring pgg-output-buffer))) + process status) + (unwind-protect + (progn + (setq process (pgg-gpg-start-process args)) + (pgg-gpg-wait-for-completion process) + (pgg-gpg-read-output-file output-file-name) + (insert-buffer-substring pgg-output-buffer)) + (if (and process (buffer-live-p (process-buffer process))) + (kill-buffer (process-buffer process))) + (if (file-exists-p output-file-name) + (delete-file output-file-name))))) (defun pgg-gpg-snarf-keys-region (start end) - "Add all public keys in region between START and END to the keyring." - (let* ((args '("--import" "-")) - (process (pgg-gpg-start-process args)) - status) - (process-send-region process start end) - (pgg-gpg-wait-for-completion process) - (save-excursion - (set-buffer (get-buffer-create pgg-errors-buffer)) - (goto-char (point-max)) - (not (null (re-search-backward "^\\[GNUPG:] IMPORT_RES\\>" - nil t)))))) + "This function is for internal use only. + +Add all public keys in region between START and END to the keyring." + (let ((args '("--import" "-")) + process) + (unwind-protect + (progn + (setq process (pgg-gpg-start-process args)) + (if (eq (process-status process) 'run) + (process-send-region process start end)) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (not (null (re-search-backward + "^\\[GNUPG:] IMPORT_RES\\>" + nil t))))) + (if (and process (buffer-live-p (process-buffer process))) + (kill-buffer (process-buffer process)))))) (provide 'pgg-gpg) Index: lisp/pgg-pgp.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/pgg-pgp.el,v retrieving revision 7.10 diff -u -r7.10 pgg-pgp.el --- lisp/pgg-pgp.el 8 Feb 2006 04:17:15 -0000 7.10 +++ lisp/pgg-pgp.el 7 Apr 2006 08:07:27 -0000 @@ -24,6 +24,11 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. +;;; Commentary: + +;; NOTE: This file is a backend of pgg.el. Please do not directly +;; call functions defined in this file from your program. + ;;; Code: (eval-when-compile @@ -115,7 +120,9 @@ (file-error nil))))) (defun pgg-pgp-lookup-key (string &optional type) - "Search keys associated with STRING." + "This function is for internal use only. + +Search keys associated with STRING." (let ((args (list "+batchmode" "+language=en" "-kv" string))) (with-current-buffer (get-buffer-create pgg-output-buffer) (buffer-disable-undo) @@ -133,7 +140,9 @@ 2)))))) (defun pgg-pgp-encrypt-region (start end recipients &optional sign passphrase) - "Encrypt the current region between START and END." + "This function is for internal use only. + +Encrypt the current region between START and END." (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) (passphrase (or passphrase (when sign @@ -155,7 +164,9 @@ (pgg-process-when-success nil))) (defun pgg-pgp-decrypt-region (start end &optional passphrase) - "Decrypt the current region between START and END. + "This function is for internal use only. + +Decrypt the current region between START and END. If optional PASSPHRASE is not specified, it will be obtained from the passphrase cache or user." @@ -173,7 +184,9 @@ (pgg-add-passphrase-to-cache key passphrase))))) (defun pgg-pgp-sign-region (start end &optional clearsign passphrase) - "Make detached signature from text between START and END. + "This function is for internal use only. + +Make detached signature from text between START and END. If optional PASSPHRASE is not specified, it will be obtained from the passphrase cache or user." @@ -202,7 +215,9 @@ passphrase))))))) (defun pgg-pgp-verify-region (start end &optional signature) - "Verify region between START and END as the detached signature SIGNATURE." + "This function is for internal use only. + +Verify region between START and END as the detached signature SIGNATURE." (let* ((orig-file (pgg-make-temp-file "pgg")) (args '("+verbose=1" "+batchmode" "+language=us")) (orig-mode (default-file-modes))) @@ -234,7 +249,9 @@ (point))))))) (defun pgg-pgp-insert-key () - "Insert public key at point." + "This function is for internal use only. + +Insert public key at point." (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) (args (list "+verbose=1" "+batchmode" "+language=us" "-kxaf" @@ -243,7 +260,9 @@ (insert-buffer-substring pgg-output-buffer))) (defun pgg-pgp-snarf-keys-region (start end) - "Add all public keys in region between START and END to the keyring." + "This function is for internal use only. + +Add all public keys in region between START and END to the keyring." (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) (key-file (pgg-make-temp-file "pgg")) (args Index: lisp/pgg-pgp5.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/pgg-pgp5.el,v retrieving revision 7.7 diff -u -r7.7 pgg-pgp5.el --- lisp/pgg-pgp5.el 19 Jan 2006 11:53:12 -0000 7.7 +++ lisp/pgg-pgp5.el 7 Apr 2006 08:07:27 -0000 @@ -24,6 +24,11 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. +;;; Commentary: + +;; NOTE: This file is a backend of pgg.el. Do not directly call +;; functions defined in this file from your program. + ;;; Code: (eval-when-compile @@ -130,7 +135,9 @@ (file-error nil))))) (defun pgg-pgp5-lookup-key (string &optional type) - "Search keys associated with STRING." + "This function is for internal use only. + +Search keys associated with STRING." (let ((args (list "+language=en" "-l" string))) (with-current-buffer (get-buffer-create pgg-output-buffer) (buffer-disable-undo) @@ -144,7 +151,9 @@ 2))))) (defun pgg-pgp5-encrypt-region (start end recipients &optional sign passphrase) - "Encrypt the current region between START and END." + "This function is for internal use only. + +Encrypt the current region between START and END." (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (passphrase (or passphrase (when sign @@ -181,7 +190,9 @@ (pgg-process-when-success nil))) (defun pgg-pgp5-sign-region (start end &optional clearsign passphrase) - "Make detached signature from text between START and END." + "This function is for internal use only. + +Make detached signature from text between START and END." (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (passphrase (or passphrase @@ -206,7 +217,9 @@ passphrase))))))) (defun pgg-pgp5-verify-region (start end &optional signature) - "Verify region between START and END as the detached signature SIGNATURE." + "This function is for internal use only. + +Verify region between START and END as the detached signature SIGNATURE." (let ((orig-file (pgg-make-temp-file "pgg")) (args '("+verbose=1" "+batchmode=1" "+language=us")) (orig-mode (default-file-modes))) @@ -233,7 +246,9 @@ nil)))) (defun pgg-pgp5-insert-key () - "Insert public key at point." + "This function is for internal use only. + +Insert public key at point." (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (args (list "+verbose=1" "+batchmode=1" "+language=us" "-x" @@ -242,7 +257,9 @@ (insert-buffer-substring pgg-output-buffer))) (defun pgg-pgp5-snarf-keys-region (start end) - "Add all public keys in region between START and END to the keyring." + "This function is for internal use only. + +Add all public keys in region between START and END to the keyring." (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) (key-file (pgg-make-temp-file "pgg")) (args Index: lisp/pgg.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/pgg.el,v retrieving revision 7.10 diff -u -r7.10 pgg.el --- lisp/pgg.el 19 Jan 2006 11:53:12 -0000 7.10 +++ lisp/pgg.el 7 Apr 2006 08:07:27 -0000 @@ -33,7 +33,6 @@ (require 'pgg-parse) (require 'password) -;; Don't merge these two `eval-when-compile's. (eval-when-compile (require 'cl)) @@ -190,8 +189,8 @@ If optional argument SIGN is non-nil, do a combined sign and encrypt. -If optional PASSPHRASE is not specified, it will be obtained from the -passphrase cache or user." +Obsolete feature: if optional PASSPHRASE is not specified, it will be +obtained from the passphrase cache or user." (interactive (list (region-beginning)(region-end) (split-string (read-string "Recipients: ") "[ \t,]+"))) @@ -245,8 +244,8 @@ If optional arguments START and END are specified, only encrypt within the region. -If optional PASSPHRASE is not specified, it will be obtained from the -passphrase cache or user." +Obsolete feature: if optional PASSPHRASE is not specified, it will be +obtained from the passphrase cache or user." (interactive (list (split-string (read-string "Recipients: ") "[ \t,]+"))) (let* ((start (or start (point-min))) (end (or end (point-max))) @@ -259,8 +258,8 @@ (defun pgg-decrypt-region (start end &optional passphrase) "Decrypt the current region between START and END. -If optional PASSPHRASE is not specified, it will be obtained from the -passphrase cache or user." +Obsolete feature: if optional PASSPHRASE is not specified, it will be +obtained from the passphrase cache or user." (interactive "r") (let* ((buf (current-buffer)) (status @@ -278,8 +277,8 @@ If optional arguments START and END are specified, only decrypt within the region. -If optional PASSPHRASE is not specified, it will be obtained from the -passphrase cache or user." +Obsolete feature: if optional PASSPHRASE is not specified, it will be +obtained from the passphrase cache or user." (interactive "") (let* ((start (or start (point-min))) (end (or end (point-max))) @@ -298,8 +297,8 @@ If this function is called interactively, CLEARTEXT is enabled and the the output is displayed. -If optional PASSPHRASE is not specified, it will be obtained from the -passphrase cache or user." +Obsolete feature: if optional PASSPHRASE is not specified, it will be +obtained from the passphrase cache or user." (interactive "r") (let ((status (pgg-save-coding-system start end (pgg-invoke "sign-region" (or pgg-scheme pgg-default-scheme) @@ -323,8 +322,8 @@ If this function is called interactively, CLEARTEXT is enabled and the the output is displayed. -If optional PASSPHRASE is not specified, it will be obtained from the -passphrase cache or user." +Obsolete feature: If optional PASSPHRASE is not specified, it will be +obtained from the passphrase cache or user." (interactive "") (let* ((start (or start (point-min))) (end (or end (point-max))) @@ -338,8 +337,8 @@ ;;;###autoload (defun pgg-verify-region (start end &optional signature fetch) "Verify the current region between START and END. -If the optional 3rd argument SIGNATURE is non-nil, it is treated as -the detached signature of the current region. +If the optional 3rd argument SIGNATURE is non-nil, it points to the file +containing detached signature of the current region. If the optional 4th argument FETCH is non-nil, we attempt to fetch the signer's public key from `pgg-default-keyserver-address'." @@ -381,8 +380,8 @@ ;;;###autoload (defun pgg-verify (&optional signature fetch start end) "Verify the current buffer. -If the optional argument SIGNATURE is non-nil, it is treated as -the detached signature of the current region. +If the optional argument SIGNATURE is non-nil, it points to the file +containing the detached signature of the current region. If the optional argument FETCH is non-nil, we attempt to fetch the signer's public key from `pgg-default-keyserver-address'. If optional arguments START and END are specified, only verify data @@ -422,6 +421,10 @@ (defun pgg-lookup-key (string &optional type) (pgg-invoke "lookup-key" (or pgg-scheme pgg-default-scheme) string type)) + +;;;###autoload +(defun pgg-list-keys (name &optional secret) + (pgg-invoke "list-keys" (or pgg-scheme pgg-default-scheme) name secret)) (defvar pgg-insert-url-function (function pgg-insert-url-with-w3)) --Multipart_Fri_Apr__7_17:09:40_2006-1 Content-Type: text/plain; charset=US-ASCII Regards, -- Daiki Ueno --Multipart_Fri_Apr__7_17:09:40_2006-1--