Mercurial > emacs
annotate lisp/pgg-pgp.el @ 94680:5af369a095b7
Switch to recommended form of GPLv3 permissions notice.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 06 May 2008 08:02:25 +0000 |
parents | ee5932bf781d |
children | a9dc0e7c3f2b |
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, |
79721 | 4 ;; 2005, 2006, 2007, 2008 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 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79721
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
66383
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 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79721
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79721
diff
changeset
|
15 ;; (at your option) any later version. |
66383
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 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79721
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
24 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
25 ;;; Code: |
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 (eval-when-compile |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
28 (require 'cl) ; for pgg macros |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
29 (require 'pgg)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
30 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
31 (defgroup pgg-pgp () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
32 "PGP 2.* and 6.* interface." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
33 :group 'pgg) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
34 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
35 (defcustom pgg-pgp-program "pgp" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
36 "PGP 2.* and 6.* executable." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
37 :group 'pgg-pgp |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
38 :type 'string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
39 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
40 (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
|
41 "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
|
42 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
|
43 :group 'pgg-pgp |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
44 :type 'string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
45 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
46 (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
|
47 "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
|
48 :group 'pgg-pgp |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
49 :type 'string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
50 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
51 (defcustom pgg-pgp-extra-args nil |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
52 "Extra arguments for every PGP invocation." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
53 :group 'pgg-pgp |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
54 :type '(choice |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
55 (const :tag "None" nil) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
56 (string :tag "Arguments"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
57 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
58 (defvar pgg-pgp-user-id nil |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
59 "PGP ID of your default identity.") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
60 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
61 (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
|
62 (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
|
63 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
64 (concat args |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
65 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
|
66 " 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
|
67 (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
|
68 (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
|
69 (process-environment process-environment) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
70 (output-buffer pgg-output-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
71 (errors-buffer pgg-errors-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
72 (process-connection-type nil) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
73 process status exit-status) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
74 (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
|
75 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
76 (erase-buffer)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
77 (when passphrase |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
78 (setenv "PGPPASSFD" "0")) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
79 (unwind-protect |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
80 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
81 (let ((coding-system-for-read 'binary) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
82 (coding-system-for-write 'binary)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
83 (setq process |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
84 (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
|
85 (concat program " " args)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
86 (set-process-sentinel process #'ignore) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
87 (when passphrase |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
88 (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
|
89 (process-send-region process start end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
90 (process-send-eof process) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
91 (while (eq 'run (process-status process)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
92 (accept-process-output process 5)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
93 (setq status (process-status process) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
94 exit-status (process-exit-status process)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
95 (delete-process process) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
96 (with-current-buffer output-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
97 (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
|
98 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
99 (if (memq status '(stop signal)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
100 (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
|
101 (if (= 127 exit-status) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
102 (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
|
103 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
104 (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
|
105 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
106 (erase-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
107 (insert-file-contents errors-file-name))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
108 (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
|
109 (interrupt-process process)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
110 (condition-case nil |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
111 (delete-file errors-file-name) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
112 (file-error nil))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
113 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
114 (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
|
115 "Search keys associated with STRING." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
116 (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
|
117 (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
|
118 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
119 (erase-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
120 (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
|
121 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
122 (cond |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
123 ((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
|
124 (buffer-substring (point)(+ 8 (point)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
125 ((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
|
126 (beginning-of-line 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
127 (substring |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
128 (nth 2 (split-string |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
129 (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
|
130 2)))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
131 |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
132 (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
|
133 "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
|
134 (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
|
135 (passphrase (or passphrase |
71262 | 136 (when sign |
137 (pgg-read-passphrase | |
138 (format "PGP passphrase for %s: " | |
139 pgg-pgp-user-id) | |
140 pgg-pgp-user-id)))) | |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
141 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
142 (concat |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
143 "+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
|
144 (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
|
145 (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
|
146 (append recipients |
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
147 (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
|
148 (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
|
149 (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
|
150 (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
|
151 (pgg-process-when-success nil))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
152 |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
153 (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
|
154 "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
|
155 |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
156 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
|
157 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
158 (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
|
159 (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
|
160 (passphrase |
71262 | 161 (or passphrase |
162 (pgg-read-passphrase | |
163 (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
|
164 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
165 "+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
|
166 (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
|
167 (pgg-process-when-success |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
168 (if pgg-cache-passphrase |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
169 (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
|
170 |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
171 (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
|
172 "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
|
173 |
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
174 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
|
175 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
176 (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
|
177 (passphrase |
71262 | 178 (or passphrase |
179 (pgg-read-passphrase | |
180 (format "PGP passphrase for %s: " pgg-pgp-user-id) | |
181 (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
|
182 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
183 (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
|
184 " +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
|
185 " -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
|
186 (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
|
187 (pgg-process-when-success |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
188 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
189 (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
|
190 (let ((packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
191 (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
|
192 (progn (beginning-of-line 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
193 (point)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
194 (point-max)))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
195 (if pgg-cache-passphrase |
66697
d13e07d1fdd3
(pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
196 (pgg-add-passphrase-to-cache |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
197 (cdr (assq 'key-identifier packet)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
198 passphrase))))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
199 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
200 (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
|
201 "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
|
202 (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
|
203 (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
|
204 (orig-mode (default-file-modes))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
205 (unwind-protect |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
206 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
207 (set-default-file-modes 448) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
208 (let ((coding-system-for-write 'binary) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
209 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
|
210 (write-region start end orig-file))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
211 (set-default-file-modes orig-mode)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
212 (if (stringp signature) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
213 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
214 (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
|
215 (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
|
216 (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
|
217 (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
|
218 (delete-file orig-file) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
219 (if signature (delete-file signature)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
220 (pgg-process-when-success |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
221 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
222 (let ((case-fold-search t)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
223 (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
|
224 (delete-region (match-beginning 0) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
225 (progn (beginning-of-line 2) (point))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
226 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
227 (when (re-search-forward "^\\.$" nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
228 (delete-region (point-min) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
229 (progn (beginning-of-line 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
230 (point))))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
231 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
232 (defun pgg-pgp-insert-key () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
233 "Insert public key at point." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
234 (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
|
235 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
236 (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
|
237 (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
|
238 (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
|
239 (insert-buffer-substring pgg-output-buffer))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
240 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
241 (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
|
242 "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
|
243 (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
|
244 (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
|
245 (args |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
246 (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
|
247 (shell-quote-argument key-file)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
248 (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
|
249 (write-region start end key-file)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
250 (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
|
251 (delete-file key-file) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
252 (pgg-process-when-success nil))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
253 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
254 (provide 'pgg-pgp) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
255 |
74165
dcc98f8861e9
(pgg-pgp-process-region): Change `args' from a list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71262
diff
changeset
|
256 ;; 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
|
257 ;;; pgg-pgp.el ends here |