Mercurial > emacs
annotate lisp/pgg-pgp.el @ 76721:7ed73702049d
*** empty log message ***
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Sun, 25 Mar 2007 12:01:03 +0000 |
parents | d6f2673064e7 |
children | 9355f9b7bbff |
rev | line source |
---|---|
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
1 ;;; pgg-pgp.el --- PGP 2.* and 6.* 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, |
75347 | 4 ;; 2005, 2006, 2007 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> |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
7 ;; Created: 1999/11/02 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
8 ;; Keywords: PGP, OpenPGP |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
9 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
10 ;; 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
|
11 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
12 ;; 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
|
13 ;; 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
|
14 ;; 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
|
15 ;; any later version. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
16 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
17 ;; 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
|
18 ;; 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
|
19 ;; 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
|
20 ;; 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
|
21 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
22 ;; 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
|
23 ;; 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
|
24 ;; 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
|
25 ;; Boston, MA 02110-1301, USA. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
26 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
27 ;;; Code: |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
28 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
29 (eval-when-compile |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
30 (require 'cl) ; for pgg macros |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
31 (require 'pgg)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
32 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
33 (defgroup pgg-pgp () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
34 "PGP 2.* and 6.* interface." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
35 :group 'pgg) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
36 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
37 (defcustom pgg-pgp-program "pgp" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
38 "PGP 2.* and 6.* executable." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
39 :group 'pgg-pgp |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
40 :type 'string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
41 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
42 (defcustom pgg-pgp-shell-file-name "/bin/sh" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
43 "File name to load inferior shells from. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
44 Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
45 :group 'pgg-pgp |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
46 :type 'string) |
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-pgp-shell-command-switch "-c" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
49 "Switch used to have the shell execute its command line argument." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
50 :group 'pgg-pgp |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
51 :type 'string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
52 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
53 (defcustom pgg-pgp-extra-args nil |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
54 "Extra arguments for every PGP invocation." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
55 :group 'pgg-pgp |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
56 :type '(choice |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
57 (const :tag "None" nil) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
58 (string :tag "Arguments"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
59 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
60 (defvar pgg-pgp-user-id nil |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
61 "PGP ID of your default identity.") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
62 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
63 (defun pgg-pgp-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
|
64 (let* ((errors-file-name (pgg-make-temp-file "pgg-errors")) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
65 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
66 (concat args |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
67 pgg-pgp-extra-args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
68 " 2>" (shell-quote-argument errors-file-name))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
69 (shell-file-name pgg-pgp-shell-file-name) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
70 (shell-command-switch pgg-pgp-shell-command-switch) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
71 (process-environment process-environment) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
72 (output-buffer pgg-output-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
73 (errors-buffer pgg-errors-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
74 (process-connection-type nil) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
75 process status exit-status) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
76 (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
|
77 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
78 (erase-buffer)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
79 (when passphrase |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
80 (setenv "PGPPASSFD" "0")) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
81 (unwind-protect |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
82 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
83 (let ((coding-system-for-read 'binary) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
84 (coding-system-for-write 'binary)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
85 (setq process |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
86 (start-process-shell-command "*PGP*" output-buffer |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
87 (concat program " " args)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
88 (set-process-sentinel process #'ignore) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
89 (when passphrase |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
90 (process-send-string process (concat passphrase "\n"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
91 (process-send-region process start end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
92 (process-send-eof process) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
93 (while (eq 'run (process-status process)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
94 (accept-process-output process 5)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
95 (setq status (process-status process) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
96 exit-status (process-exit-status process)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
97 (delete-process process) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
98 (with-current-buffer output-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
99 (pgg-convert-lbt-region (point-min)(point-max) 'LF) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
100 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
101 (if (memq status '(stop signal)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
102 (error "%s exited abnormally: '%s'" program exit-status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
103 (if (= 127 exit-status) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
104 (error "%s could not be found" program)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
105 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
106 (set-buffer (get-buffer-create errors-buffer)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
107 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
108 (erase-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
109 (insert-file-contents errors-file-name))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
110 (if (and process (eq 'run (process-status process))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
111 (interrupt-process process)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
112 (condition-case nil |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
113 (delete-file errors-file-name) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
114 (file-error nil))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
115 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
116 (defun pgg-pgp-lookup-key (string &optional type) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
117 "Search keys associated with STRING." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
118 (let ((args (list "+batchmode" "+language=en" "-kv" string))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
119 (with-current-buffer (get-buffer-create pgg-output-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
120 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
121 (erase-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
122 (apply #'call-process pgg-pgp-program nil t nil args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
123 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
124 (cond |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
125 ((re-search-forward "^pub\\s +[0-9]+/" nil t);PGP 2.* |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
126 (buffer-substring (point)(+ 8 (point)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
127 ((re-search-forward "^Type" nil t);PGP 6.* |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
128 (beginning-of-line 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
129 (substring |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
130 (nth 2 (split-string |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
131 (buffer-substring (point)(progn (end-of-line) (point))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
132 2)))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
133 |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
134 (defun pgg-pgp-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
|
135 "Encrypt the current region between START and END." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
136 (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
137 (passphrase (or passphrase |
71262 | 138 (when sign |
139 (pgg-read-passphrase | |
140 (format "PGP passphrase for %s: " | |
141 pgg-pgp-user-id) | |
142 pgg-pgp-user-id)))) | |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
143 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
144 (concat |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
145 "+encrypttoself=off +verbose=1 +batchmode +language=us -fate " |
76110
d6f2673064e7
2007-02-24 Chris Moore <dooglus@gmail.com>
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
146 (if (or recipients pgg-encrypt-for-me) |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
147 (mapconcat 'shell-quote-argument |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
148 (append recipients |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
149 (if pgg-encrypt-for-me |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
150 (list pgg-pgp-user-id))))) |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
151 (if sign (concat " -s -u " (shell-quote-argument pgg-pgp-user-id)))))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
152 (pgg-pgp-process-region start end nil pgg-pgp-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
153 (pgg-process-when-success nil))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
154 |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
155 (defun pgg-pgp-decrypt-region (start end &optional passphrase) |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
156 "Decrypt the current region between START and END. |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
157 |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
158 If optional PASSPHRASE is not specified, it will be obtained from the |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
159 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
160 (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
161 (key (pgg-pgp-lookup-key pgg-pgp-user-id 'encrypt)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
162 (passphrase |
71262 | 163 (or passphrase |
164 (pgg-read-passphrase | |
165 (format "PGP passphrase for %s: " pgg-pgp-user-id) key))) | |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
166 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
167 "+verbose=1 +batchmode +language=us -f")) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
168 (pgg-pgp-process-region start end passphrase pgg-pgp-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
169 (pgg-process-when-success |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
170 (if pgg-cache-passphrase |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
171 (pgg-add-passphrase-to-cache key passphrase))))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
172 |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
173 (defun pgg-pgp-sign-region (start end &optional clearsign passphrase) |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
174 "Make detached signature from text between START and END. |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
175 |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
176 If optional PASSPHRASE is not specified, it will be obtained from the |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
177 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
178 (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
179 (passphrase |
71262 | 180 (or passphrase |
181 (pgg-read-passphrase | |
182 (format "PGP passphrase for %s: " pgg-pgp-user-id) | |
183 (pgg-pgp-lookup-key pgg-pgp-user-id 'sign)))) | |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
184 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
185 (concat (if clearsign "-fast" "-fbast") |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
186 " +verbose=1 +language=us +batchmode" |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
187 " -u " (shell-quote-argument pgg-pgp-user-id)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
188 (pgg-pgp-process-region start end passphrase pgg-pgp-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
189 (pgg-process-when-success |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
190 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
191 (when (re-search-forward "^-+BEGIN PGP" nil t);XXX |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
192 (let ((packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
193 (cdr (assq 2 (pgg-parse-armor-region |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
194 (progn (beginning-of-line 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
195 (point)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
196 (point-max)))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
197 (if pgg-cache-passphrase |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
198 (pgg-add-passphrase-to-cache |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
199 (cdr (assq 'key-identifier packet)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
200 passphrase))))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
201 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
202 (defun pgg-pgp-verify-region (start end &optional signature) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
203 "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
|
204 (let* ((orig-file (pgg-make-temp-file "pgg")) |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
205 (args "+verbose=1 +batchmode +language=us") |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
206 (orig-mode (default-file-modes))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
207 (unwind-protect |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
208 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
209 (set-default-file-modes 448) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
210 (let ((coding-system-for-write 'binary) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
211 jka-compr-compression-info-list jam-zcat-filename-list) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
212 (write-region start end orig-file))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
213 (set-default-file-modes orig-mode)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
214 (if (stringp signature) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
215 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
216 (copy-file signature (setq signature (concat orig-file ".asc"))) |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
217 (setq args (concat args " " (shell-quote-argument signature))))) |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
218 (setq args (concat args " " (shell-quote-argument orig-file))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
219 (pgg-pgp-process-region (point)(point) nil pgg-pgp-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
220 (delete-file orig-file) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
221 (if signature (delete-file signature)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
222 (pgg-process-when-success |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
223 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
224 (let ((case-fold-search t)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
225 (while (re-search-forward "^warning: " nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
226 (delete-region (match-beginning 0) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
227 (progn (beginning-of-line 2) (point))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
228 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
229 (when (re-search-forward "^\\.$" nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
230 (delete-region (point-min) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
231 (progn (beginning-of-line 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
232 (point))))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
233 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
234 (defun pgg-pgp-insert-key () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
235 "Insert public key at point." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
236 (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
237 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
238 (concat "+verbose=1 +batchmode +language=us -kxaf " |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
239 (shell-quote-argument pgg-pgp-user-id)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
240 (pgg-pgp-process-region (point)(point) nil pgg-pgp-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
241 (insert-buffer-substring pgg-output-buffer))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
242 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
243 (defun pgg-pgp-snarf-keys-region (start end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
244 "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
|
245 (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
246 (key-file (pgg-make-temp-file "pgg")) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
247 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
248 (concat "+verbose=1 +batchmode +language=us -kaf " |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
249 (shell-quote-argument key-file)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
250 (let ((coding-system-for-write 'raw-text-dos)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
251 (write-region start end key-file)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
252 (pgg-pgp-process-region start end nil pgg-pgp-program args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
253 (delete-file key-file) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
254 (pgg-process-when-success nil))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
255 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
256 (provide 'pgg-pgp) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
257 |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
258 ;; arch-tag: 076b7801-37b2-49a6-97c3-218fdecde33c |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
259 ;;; pgg-pgp.el ends here |