Mercurial > emacs
annotate lisp/pgg-gpg.el @ 69104:527507f1a62e
(Fwindow_list): Check `window' before doing XWINDOW.
The default `window' should not be "on a different frame".
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 22 Feb 2006 21:01:34 +0000 |
parents | 970bf6e6463b |
children | 7672ac27989e |
rev | line source |
---|---|
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
1 ;;; pgg-gpg.el --- GnuPG support for PGG. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
2 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
3 ;; Copyright (C) 1999, 2000, 2002, 2003, 2004, |
68651
3bd95f4f2941
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
66520
diff
changeset
|
4 ;; 2005, 2006 Free Software Foundation, Inc. |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
5 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
6 ;; Author: Daiki Ueno <ueno@unixuser.org> |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
7 ;; Symmetric encryption added by: Sascha Wilde <wilde@sha-bang.de> |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
8 ;; Created: 1999/10/28 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
9 ;; Keywords: PGP, OpenPGP, GnuPG |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
10 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
11 ;; This file is part of GNU Emacs. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
12 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
14 ;; it under the terms of the GNU General Public License as published by |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
15 ;; the Free Software Foundation; either version 2, or (at your option) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
16 ;; any later version. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
17 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
18 ;; GNU Emacs is distributed in the hope that it will be useful, |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
21 ;; GNU General Public License for more details. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
22 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
23 ;; You should have received a copy of the GNU General Public License |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
26 ;; Boston, MA 02110-1301, USA. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
27 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
28 ;;; Code: |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
29 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
30 (eval-when-compile |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
31 (require 'cl) ; for gpg macros |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
32 (require 'pgg)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
33 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
34 (defgroup pgg-gpg () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
35 "GnuPG interface." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
36 :group 'pgg) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
37 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
38 (defcustom pgg-gpg-program "gpg" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
39 "The GnuPG executable." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
40 :group 'pgg-gpg |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
41 :type 'string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
42 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
43 (defcustom pgg-gpg-extra-args nil |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
44 "Extra arguments for every GnuPG invocation." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
45 :group 'pgg-gpg |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
46 :type '(repeat (string :tag "Argument"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
47 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
48 (defcustom pgg-gpg-recipient-argument "--recipient" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
49 "GnuPG option to specify recipient." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
50 :group 'pgg-gpg |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
51 :type '(choice (const :tag "New `--recipient' option" "--recipient") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
52 (const :tag "Old `--remote-user' option" "--remote-user"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
53 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
54 (defvar pgg-gpg-user-id nil |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
55 "GnuPG ID of your default identity.") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
56 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
57 (defun pgg-gpg-process-region (start end passphrase program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
58 (let* ((output-file-name (pgg-make-temp-file "pgg-output")) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
59 (args |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
60 `("--status-fd" "2" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
61 ,@(if passphrase '("--passphrase-fd" "0")) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
62 "--yes" ; overwrite |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
63 "--output" ,output-file-name |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
64 ,@pgg-gpg-extra-args ,@args)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
65 (output-buffer pgg-output-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
66 (errors-buffer pgg-errors-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
67 (orig-mode (default-file-modes)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
68 (process-connection-type nil) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
69 exit-status) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
70 (with-current-buffer (get-buffer-create errors-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
71 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
72 (erase-buffer)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
73 (unwind-protect |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
74 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
75 (set-default-file-modes 448) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
76 (let ((coding-system-for-write 'binary) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
77 (input (buffer-substring-no-properties start end)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
78 (default-enable-multibyte-characters nil)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
79 (with-temp-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
80 (when passphrase |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
81 (insert passphrase "\n")) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
82 (insert input) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
83 (setq exit-status |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
84 (apply #'call-process-region (point-min) (point-max) program |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
85 nil errors-buffer nil args)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
86 (with-current-buffer (get-buffer-create output-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
87 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
88 (erase-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
89 (if (file-exists-p output-file-name) |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
90 (let ((coding-system-for-read (if pgg-text-mode |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
91 'raw-text |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
92 'binary))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
93 (insert-file-contents output-file-name))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
94 (set-buffer errors-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
95 (if (not (equal exit-status 0)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
96 (insert (format "\n%s exited abnormally: '%s'\n" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
97 program exit-status))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
98 (if (file-exists-p output-file-name) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
99 (delete-file output-file-name)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
100 (set-default-file-modes orig-mode)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
101 |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
102 (defun pgg-gpg-possibly-cache-passphrase (passphrase &optional key notruncate) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
103 (if (and pgg-cache-passphrase |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
104 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
105 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
106 (re-search-forward "^\\[GNUPG:] \\(GOOD_PASSPHRASE\\>\\)\\|\\(SIG_CREATED\\)" nil t))) |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
107 (pgg-add-passphrase-to-cache |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
108 (or key |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
109 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
110 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
111 (if (re-search-forward |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
112 "^\\[GNUPG:] NEED_PASSPHRASE\\(_PIN\\)? \\w+ ?\\w*" nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
113 (substring (match-string 0) -8)))) |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
114 passphrase |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
115 notruncate))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
116 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
117 (defvar pgg-gpg-all-secret-keys 'unknown) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
118 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
119 (defun pgg-gpg-lookup-all-secret-keys () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
120 "Return all secret keys present in secret key ring." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
121 (when (eq pgg-gpg-all-secret-keys 'unknown) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
122 (setq pgg-gpg-all-secret-keys '()) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
123 (let ((args (list "--with-colons" "--no-greeting" "--batch" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
124 "--list-secret-keys"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
125 (with-temp-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
126 (apply #'call-process pgg-gpg-program nil t nil args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
127 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
128 (while (re-search-forward |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
129 "^\\(sec\\|pub\\):[^:]*:[^:]*:[^:]*:\\([^:]*\\)" nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
130 (push (substring (match-string 2) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
131 pgg-gpg-all-secret-keys))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
132 pgg-gpg-all-secret-keys) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
133 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
134 (defun pgg-gpg-lookup-key (string &optional type) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
135 "Search keys associated with STRING." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
136 (let ((args (list "--with-colons" "--no-greeting" "--batch" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
137 (if type "--list-secret-keys" "--list-keys") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
138 string))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
139 (with-temp-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
140 (apply #'call-process pgg-gpg-program nil t nil args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
141 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
142 (if (re-search-forward "^\\(sec\\|pub\\):[^:]*:[^:]*:[^:]*:\\([^:]*\\)" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
143 nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
144 (substring (match-string 2) 8))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
145 |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
146 (defun pgg-gpg-lookup-key-owner (string &optional all) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
147 "Search keys associated with STRING and return owner of identified key. |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
148 |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
149 The value may be just the bare key id, or it may be a combination of the |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
150 user name associated with the key and the key id, with the key id enclosed |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
151 in \"<...>\" angle brackets. |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
152 |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
153 Optional ALL non-nil means search all keys, including secret keys." |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
154 (let ((args (list "--with-colons" "--no-greeting" "--batch" |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
155 (if all "--list-secret-keys" "--list-keys") |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
156 string)) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
157 (key-regexp (concat "^\\(sec\\|pub\\)" |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
158 ":[^:]*:[^:]*:[^:]*:\\([^:]*\\):[^:]*" |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
159 ":[^:]*:[^:]*:[^:]*:\\([^:]*\\):")) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
160 ) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
161 (with-temp-buffer |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
162 (apply #'call-process pgg-gpg-program nil t nil args) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
163 (goto-char (point-min)) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
164 (if (re-search-forward key-regexp |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
165 nil t) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
166 (match-string 3))))) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
167 |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
168 (defun pgg-gpg-key-id-from-key-owner (key-owner) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
169 (cond ((not key-owner) nil) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
170 ;; Extract bare key id from outermost paired angle brackets, if any: |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
171 ((string-match "[^<]*<\\(.+\\)>[^>]*" key-owner) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
172 (substring key-owner (match-beginning 1)(match-end 1))) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
173 (key-owner)) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
174 ) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
175 |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
176 (defun pgg-gpg-encrypt-region (start end recipients &optional sign passphrase) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
177 "Encrypt the current region between START and END. |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
178 |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
179 If optional argument SIGN is non-nil, do a combined sign and encrypt. |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
180 |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
181 If optional PASSPHRASE is not specified, it will be obtained from the |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
182 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
183 (let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
184 (passphrase (or passphrase |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
185 (when sign |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
186 (pgg-read-passphrase |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
187 (format "GnuPG passphrase for %s: " |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
188 pgg-gpg-user-id) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
189 pgg-gpg-user-id)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
190 (args |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
191 (append |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
192 (list "--batch" "--armor" "--always-trust" "--encrypt") |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
193 (if pgg-text-mode (list "--textmode")) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
194 (if sign (list "--sign" "--local-user" pgg-gpg-user-id)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
195 (if recipients |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
196 (apply #'nconc |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
197 (mapcar (lambda (rcpt) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
198 (list pgg-gpg-recipient-argument rcpt)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
199 (append recipients |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
200 (if pgg-encrypt-for-me |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
201 (list pgg-gpg-user-id))))))))) |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
202 (pgg-gpg-process-region start end passphrase pgg-gpg-program args) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
203 (when sign |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
204 (with-current-buffer pgg-errors-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
205 ;; Possibly cache passphrase under, e.g. "jas", for future sign. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
206 (pgg-gpg-possibly-cache-passphrase passphrase pgg-gpg-user-id) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
207 ;; Possibly cache passphrase under, e.g. B565716F, for future decrypt. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
208 (pgg-gpg-possibly-cache-passphrase passphrase))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
209 (pgg-process-when-success))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
210 |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
211 (defun pgg-gpg-encrypt-symmetric-region (start end &optional passphrase) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
212 "Encrypt the current region between START and END with symmetric cipher. |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
213 |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
214 If optional PASSPHRASE is not specified, it will be obtained from the |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
215 passphrase cache or user." |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
216 (let* ((passphrase (or passphrase |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
217 (pgg-read-passphrase |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
218 "GnuPG passphrase for symmetric encryption: "))) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
219 (args |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
220 (append (list "--batch" "--armor" "--symmetric" ) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
221 (if pgg-text-mode (list "--textmode"))))) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
222 (pgg-gpg-process-region start end passphrase pgg-gpg-program args) |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
223 (pgg-process-when-success))) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
224 |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
225 (defun pgg-gpg-decrypt-region (start end &optional passphrase) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
226 "Decrypt the current region between START and END. |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
227 |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
228 If optional PASSPHRASE is not specified, it will be obtained from the |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
229 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
230 (let* ((current-buffer (current-buffer)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
231 (message-keys (with-temp-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
232 (insert-buffer-substring current-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
233 (pgg-decode-armor-region (point-min) (point-max)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
234 (secret-keys (pgg-gpg-lookup-all-secret-keys)) |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
235 ;; XXX the user is stuck if they need to use the passphrase for |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
236 ;; any but the first secret key for which the message is |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
237 ;; encrypted. ideally, we would incrementally give them a |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
238 ;; chance with subsequent keys each time they fail with one. |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
239 (key (pgg-gpg-select-matching-key message-keys secret-keys)) |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
240 (key-owner (and key (pgg-gpg-lookup-key-owner key t))) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
241 (key-id (pgg-gpg-key-id-from-key-owner key-owner)) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
242 (pgg-gpg-user-id (or key-id key |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
243 pgg-gpg-user-id pgg-default-user-id)) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
244 (passphrase (or passphrase |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
245 (pgg-read-passphrase |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
246 (format (if (pgg-gpg-symmetric-key-p message-keys) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
247 "Passphrase for symmetric decryption: " |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
248 "GnuPG passphrase for %s: ") |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
249 (or key-owner "??")) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
250 pgg-gpg-user-id))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
251 (args '("--batch" "--decrypt"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
252 (pgg-gpg-process-region start end passphrase pgg-gpg-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
253 (with-current-buffer pgg-errors-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
254 (pgg-gpg-possibly-cache-passphrase passphrase pgg-gpg-user-id) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
255 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
256 (re-search-forward "^\\[GNUPG:] DECRYPTION_OKAY\\>" nil t)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
257 |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
258 ;;;###autoload |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
259 (defun pgg-gpg-symmetric-key-p (message-keys) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
260 "True if decoded armor MESSAGE-KEYS has symmetric encryption indicator." |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
261 (let (result) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
262 (dolist (key message-keys result) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
263 (when (and (eq (car key) 3) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
264 (member '(symmetric-key-algorithm) key)) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
265 (setq result key))))) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
266 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
267 (defun pgg-gpg-select-matching-key (message-keys secret-keys) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
268 "Choose a key from MESSAGE-KEYS that matches one of the keys in SECRET-KEYS." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
269 (loop for message-key in message-keys |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
270 for message-key-id = (and (equal (car message-key) 1) |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
271 (cdr (assq 'key-identifier |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
272 (cdr message-key)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
273 for key = (and message-key-id (pgg-lookup-key message-key-id 'encrypt)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
274 when (and key (member key secret-keys)) return key)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
275 |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
276 (defun pgg-gpg-sign-region (start end &optional cleartext passphrase) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
277 "Make detached signature from text between START and END." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
278 (let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) |
66520
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
279 (passphrase (or passphrase |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
280 (pgg-read-passphrase |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
281 (format "GnuPG passphrase for %s: " pgg-gpg-user-id) |
67afcf271a8f
(pgg-gpg-select-matching-key): Fixed: look at the right part of the
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
282 pgg-gpg-user-id))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
283 (args |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
284 (append (list (if cleartext "--clearsign" "--detach-sign") |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
285 "--armor" "--batch" "--verbose" |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
286 "--local-user" pgg-gpg-user-id) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
287 (if pgg-text-mode (list "--textmode")))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
288 (inhibit-read-only t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
289 buffer-read-only) |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68651
diff
changeset
|
290 (pgg-gpg-process-region start end passphrase pgg-gpg-program args) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
291 (with-current-buffer pgg-errors-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
292 ;; Possibly cache passphrase under, e.g. "jas", for future sign. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
293 (pgg-gpg-possibly-cache-passphrase passphrase pgg-gpg-user-id) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
294 ;; Possibly cache passphrase under, e.g. B565716F, for future decrypt. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
295 (pgg-gpg-possibly-cache-passphrase passphrase)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
296 (pgg-process-when-success))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
297 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
298 (defun pgg-gpg-verify-region (start end &optional signature) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
299 "Verify region between START and END as the detached signature SIGNATURE." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
300 (let ((args '("--batch" "--verify"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
301 (when (stringp signature) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
302 (setq args (append args (list signature)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
303 (setq args (append args '("-"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
304 (pgg-gpg-process-region start end nil pgg-gpg-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
305 (with-current-buffer pgg-errors-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
306 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
307 (while (re-search-forward "^gpg: \\(.*\\)\n" nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
308 (with-current-buffer pgg-output-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
309 (insert-buffer-substring pgg-errors-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
310 (match-beginning 1) (match-end 0))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
311 (delete-region (match-beginning 0) (match-end 0))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
312 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
313 (re-search-forward "^\\[GNUPG:] GOODSIG\\>" nil t)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
314 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
315 (defun pgg-gpg-insert-key () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
316 "Insert public key at point." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
317 (let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
318 (args (list "--batch" "--export" "--armor" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
319 pgg-gpg-user-id))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
320 (pgg-gpg-process-region (point)(point) nil pgg-gpg-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
321 (insert-buffer-substring pgg-output-buffer))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
322 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
323 (defun pgg-gpg-snarf-keys-region (start end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
324 "Add all public keys in region between START and END to the keyring." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
325 (let ((args '("--import" "--batch" "-")) status) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
326 (pgg-gpg-process-region start end nil pgg-gpg-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
327 (set-buffer pgg-errors-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
328 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
329 (when (re-search-forward "^\\[GNUPG:] IMPORT_RES\\>" nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
330 (setq status (buffer-substring (match-end 0) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
331 (progn (end-of-line)(point))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
332 status (vconcat (mapcar #'string-to-number (split-string status)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
333 (erase-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
334 (insert (format "Imported %d key(s). |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
335 \tArmor contains %d key(s) [%d bad, %d old].\n" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
336 (+ (aref status 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
337 (aref status 10)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
338 (aref status 0) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
339 (aref status 1) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
340 (+ (aref status 4) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
341 (aref status 11))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
342 (if (zerop (aref status 9)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
343 "" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
344 "\tSecret keys are imported.\n"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
345 (append-to-buffer pgg-output-buffer (point-min)(point-max)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
346 (pgg-process-when-success))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
347 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
348 (provide 'pgg-gpg) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
349 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
350 ;;; arch-tag: 2aa5d5d8-93a0-4865-9312-33e29830e000 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
351 ;;; pgg-gpg.el ends here |