Mercurial > emacs
annotate lisp/pgg.el @ 91217:9cf3b1c148b9
(tai-viet-re): Include '-'.
(tai-viet-glyph-info): Handle '-'.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sun, 09 Dec 2007 12:39:55 +0000 |
parents | e793ef63bdb9 |
children | bc4976b7380e |
rev | line source |
---|---|
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
1 ;;; pgg.el --- glue for the various PGP implementations. |
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> |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
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 |
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 |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77932
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
66383
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 ;;; Commentary: |
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 ;;; Code: |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
31 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
32 (require 'pgg-def) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
33 (require 'pgg-parse) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
34 (autoload 'run-at-time "timer") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
35 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
36 ;; Don't merge these two `eval-when-compile's. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
37 (eval-when-compile |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
38 (require 'cl)) |
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 ;;; @ utility functions |
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 |
86496
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
43 (eval-when-compile |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
44 (unless (featurep 'xemacs) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
45 (defalias 'pgg-run-at-time 'run-at-time) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
46 (defalias 'pgg-cancel-timer 'cancel-timer)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
47 |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
48 (when (featurep 'xemacs) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
49 (defmacro pgg-run-at-time-1 (time repeat function args) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
50 (if (condition-case nil |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
51 (let ((delete-itimer 'delete-itimer) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
52 (itimer-driver-start 'itimer-driver-start) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
53 (itimer-value 'itimer-value) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
54 (start-itimer 'start-itimer)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
55 (unless (or (symbol-value 'itimer-process) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
56 (symbol-value 'itimer-timer)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
57 (funcall itimer-driver-start)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
58 ;; Check whether there is a bug to which the difference of |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
59 ;; the present time and the time when the itimer driver was |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
60 ;; woken up is subtracted from the initial itimer value. |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
61 (let* ((inhibit-quit t) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
62 (ctime (current-time)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
63 (itimer-timer-last-wakeup |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
64 (prog1 |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
65 ctime |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
66 (setcar ctime (1- (car ctime))))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
67 (itimer-list nil) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
68 (itimer (funcall start-itimer "pgg-run-at-time" |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
69 'ignore 5))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
70 (sleep-for 0.1) ;; Accept the timeout interrupt. |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
71 (prog1 |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
72 (> (funcall itimer-value itimer) 0) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
73 (funcall delete-itimer itimer)))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
74 (error nil)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
75 `(let ((time ,time)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
76 (apply #'start-itimer "pgg-run-at-time" |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
77 ,function (if time (max time 1e-9) 1e-9) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
78 ,repeat nil t ,args))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
79 `(let ((time ,time) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
80 (itimers (list nil))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
81 (setcar |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
82 itimers |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
83 (apply #'start-itimer "pgg-run-at-time" |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
84 (lambda (itimers repeat function &rest args) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
85 (let ((itimer (car itimers))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
86 (if repeat |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
87 (progn |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
88 (set-itimer-function |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
89 itimer |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
90 (lambda (itimer repeat function &rest args) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
91 (set-itimer-restart itimer repeat) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
92 (set-itimer-function itimer function) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
93 (set-itimer-function-arguments itimer args) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
94 (apply function args))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
95 (set-itimer-function-arguments |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
96 itimer |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
97 (append (list itimer repeat function) args))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
98 (set-itimer-function |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
99 itimer |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
100 (lambda (itimer function &rest args) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
101 (delete-itimer itimer) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
102 (apply function args))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
103 (set-itimer-function-arguments |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
104 itimer |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
105 (append (list itimer function) args))))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
106 1e-9 (if time (max time 1e-9) 1e-9) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
107 nil t itimers ,repeat ,function ,args)))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
108 |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
109 (defun pgg-run-at-time (time repeat function &rest args) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
110 "Emulating function run as `run-at-time'. |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
111 TIME should be nil meaning now, or a number of seconds from now. |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
112 Return an itimer object which can be used in either `delete-itimer' |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
113 or `cancel-timer'." |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
114 (pgg-run-at-time-1 time repeat function args)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
115 (defun pgg-cancel-timer (timer) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
116 "Emulate cancel-timer for xemacs." |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
117 (let ((delete-itimer 'delete-itimer)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
118 (funcall delete-itimer timer))) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
119 )) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
120 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
121 (defun pgg-invoke (func scheme &rest args) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
122 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
123 (require (intern (format "pgg-%s" scheme))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
124 (apply 'funcall (intern (format "pgg-%s-%s" scheme func)) args))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
125 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
126 (put 'pgg-save-coding-system 'lisp-indent-function 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
127 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
128 (defmacro pgg-save-coding-system (start end &rest body) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
129 `(if (interactive-p) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
130 (let ((buffer (current-buffer))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
131 (with-temp-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
132 (let (buffer-undo-list) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
133 (insert-buffer-substring buffer ,start ,end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
134 (encode-coding-region (point-min)(point-max) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
135 buffer-file-coding-system) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
136 (prog1 (save-excursion ,@body) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
137 (push nil buffer-undo-list) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
138 (ignore-errors (undo)))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
139 (save-restriction |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
140 (narrow-to-region ,start ,end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
141 ,@body))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
142 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
143 (defun pgg-temp-buffer-show-function (buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
144 (let ((window (or (get-buffer-window buffer 'visible) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
145 (split-window-vertically)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
146 (set-window-buffer window buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
147 (shrink-window-if-larger-than-buffer window))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
148 |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
149 ;; XXX `pgg-display-output-buffer' is a horrible name for this function. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
150 ;; It should be something like `pgg-situate-output-or-display-error'. |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
151 (defun pgg-display-output-buffer (start end status) |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
152 "Situate en/decryption results or pop up an error buffer. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
153 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
154 Text from START to END is replaced by contents of output buffer if STATUS |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
155 is true, or else the output buffer is displayed." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
156 (if status |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
157 (pgg-situate-output start end) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
158 (pgg-display-error-buffer))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
159 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
160 (defun pgg-situate-output (start end) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
161 "Place en/decryption result in place of current text from START to END." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
162 (delete-region start end) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
163 (insert-buffer-substring pgg-output-buffer) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
164 (decode-coding-region start (point) buffer-file-coding-system)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
165 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
166 (defun pgg-display-error-buffer () |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
167 "Pop up an error buffer indicating the reason for an en/decryption failure." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
168 (let ((temp-buffer-show-function |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
169 (function pgg-temp-buffer-show-function))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
170 (with-output-to-temp-buffer pgg-echo-buffer |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
171 (set-buffer standard-output) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
172 (insert-buffer-substring pgg-errors-buffer)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
173 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
174 (defvar pgg-passphrase-cache (make-vector 7 0)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
175 |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
176 (defvar pgg-pending-timers (make-vector 7 0) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
177 "Hash table for managing scheduled pgg cache management timers. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
178 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
179 We associate key and timer, so the timer can be cancelled if a new |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
180 timeout for the key is set while an old one is still pending.") |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
181 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
182 (defun pgg-read-passphrase (prompt &optional key notruncate) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
183 "Using PROMPT, obtain passphrase for KEY from cache or user. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
184 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
185 Truncate the key to 8 trailing characters unless NOTRUNCATE is true |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
186 \(default false). |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
187 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
188 Custom variables `pgg-cache-passphrase' and `pgg-passphrase-cache-expiry' |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
189 regulate cache behavior." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
190 (or (pgg-read-passphrase-from-cache key notruncate) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
191 (read-passwd prompt))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
192 |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
193 (defun pgg-read-passphrase-from-cache (key &optional notruncate) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
194 "Obtain passphrase for KEY from time-limited passphrase cache. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
195 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
196 Truncate the key to 8 trailing characters unless NOTRUNCATE is true |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
197 \(default false). |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
198 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
199 Custom variables `pgg-cache-passphrase' and `pgg-passphrase-cache-expiry' |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
200 regulate cache behavior." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
201 (and pgg-cache-passphrase |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
202 key (or notruncate |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
203 (setq key (pgg-truncate-key-identifier key))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
204 (symbol-value (intern-soft key pgg-passphrase-cache)))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
205 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
206 (defun pgg-add-passphrase-to-cache (key passphrase &optional notruncate) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
207 "Associate KEY with PASSPHRASE in time-limited passphrase cache. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
208 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
209 Truncate the key to 8 trailing characters unless NOTRUNCATE is true |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
210 \(default false). |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
211 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
212 Custom variables `pgg-cache-passphrase' and `pgg-passphrase-cache-expiry' |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
213 regulate cache behavior." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
214 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
215 (let* ((key (if notruncate key (pgg-truncate-key-identifier key))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
216 (interned-timer-key (intern-soft key pgg-pending-timers)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
217 (old-timer (symbol-value interned-timer-key)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
218 new-timer) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
219 (when old-timer |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
220 (cancel-timer old-timer) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
221 (unintern interned-timer-key pgg-pending-timers)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
222 (set (intern key pgg-passphrase-cache) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
223 passphrase) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
224 (set (intern key pgg-pending-timers) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
225 (pgg-run-at-time pgg-passphrase-cache-expiry nil |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
226 #'pgg-remove-passphrase-from-cache |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
227 key notruncate)))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
228 |
72653 | 229 (if (fboundp 'clear-string) |
230 (defalias 'pgg-clear-string 'clear-string) | |
231 (defun pgg-clear-string (string) | |
232 (fillarray string ?_))) | |
233 | |
86496
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
234 (declare-function pgg-clear-string "pgg" (string)) |
e793ef63bdb9
(pgg-clear-string): Declare as a function.
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
235 |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
236 (defun pgg-remove-passphrase-from-cache (key &optional notruncate) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
237 "Omit passphrase associated with KEY in time-limited passphrase cache. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
238 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
239 Truncate the key to 8 trailing characters unless NOTRUNCATE is true |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
240 \(default false). |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
241 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
242 This is a no-op if there is not entry for KEY (eg, it's already expired. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
243 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
244 The memory for the passphrase is filled with underscores to clear any |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
245 references to it. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
246 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
247 Custom variables `pgg-cache-passphrase' and `pgg-passphrase-cache-expiry' |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
248 regulate cache behavior." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
249 (let* ((passphrase (pgg-read-passphrase-from-cache key notruncate)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
250 (key (if notruncate key (pgg-truncate-key-identifier key))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
251 (interned-timer-key (intern-soft key pgg-pending-timers)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
252 (old-timer (symbol-value interned-timer-key))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
253 (when passphrase |
72653 | 254 (pgg-clear-string passphrase) |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
255 (unintern key pgg-passphrase-cache)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
256 (when old-timer |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
257 (pgg-cancel-timer old-timer) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
258 (unintern interned-timer-key pgg-pending-timers)))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
259 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
260 (defmacro pgg-convert-lbt-region (start end lbt) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
261 `(let ((pgg-conversion-end (set-marker (make-marker) ,end))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
262 (goto-char ,start) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
263 (case ,lbt |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
264 (CRLF |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
265 (while (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
266 (end-of-line) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
267 (> (marker-position pgg-conversion-end) (point))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
268 (insert "\r") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
269 (forward-line 1))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
270 (LF |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
271 (while (re-search-forward "\r$" pgg-conversion-end t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
272 (replace-match "")))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
273 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
274 (put 'pgg-as-lbt 'lisp-indent-function 3) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
275 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
276 (defmacro pgg-as-lbt (start end lbt &rest body) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
277 `(let ((inhibit-read-only t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
278 buffer-read-only |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
279 buffer-undo-list) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
280 (pgg-convert-lbt-region ,start ,end ,lbt) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
281 (let ((,end (point))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
282 ,@body) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
283 (push nil buffer-undo-list) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
284 (ignore-errors (undo)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
285 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
286 (put 'pgg-process-when-success 'lisp-indent-function 0) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
287 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
288 (defmacro pgg-process-when-success (&rest body) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
289 `(with-current-buffer pgg-output-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
290 (if (zerop (buffer-size)) nil ,@body t))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
291 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
292 (defalias 'pgg-make-temp-file |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
293 (if (fboundp 'make-temp-file) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
294 'make-temp-file |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
295 (lambda (prefix &optional dir-flag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
296 (let ((file (expand-file-name |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
297 (make-temp-name prefix) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
298 (if (fboundp 'temp-directory) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
299 (temp-directory) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
300 temporary-file-directory)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
301 (if dir-flag |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
302 (make-directory file)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
303 file)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
304 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
305 ;;; @ interface functions |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
306 ;;; |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
307 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
308 ;;;###autoload |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
309 (defun pgg-encrypt-region (start end rcpts &optional sign passphrase) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
310 "Encrypt the current region between START and END for RCPTS. |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
311 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
312 If optional argument SIGN is non-nil, do a combined sign and encrypt. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
313 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
314 If optional PASSPHRASE is not specified, it will be obtained from the |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
315 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
316 (interactive |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
317 (list (region-beginning)(region-end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
318 (split-string (read-string "Recipients: ") "[ \t,]+"))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
319 (let ((status |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
320 (pgg-save-coding-system start end |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
321 (pgg-invoke "encrypt-region" (or pgg-scheme pgg-default-scheme) |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
322 (point-min) (point-max) rcpts sign passphrase)))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
323 (when (interactive-p) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
324 (pgg-display-output-buffer start end status)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
325 status)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
326 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
327 ;;;###autoload |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
328 (defun pgg-encrypt-symmetric-region (start end &optional passphrase) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
329 "Encrypt the current region between START and END symmetric with passphrase. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
330 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
331 If optional PASSPHRASE is not specified, it will be obtained from the |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
332 cache or user." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
333 (interactive "r") |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
334 (let ((status |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
335 (pgg-save-coding-system start end |
77932
491c39d86dc0
(pgg-sign-region, pgg-sign): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
336 (pgg-invoke "encrypt-symmetric-region" |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
337 (or pgg-scheme pgg-default-scheme) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
338 (point-min) (point-max) passphrase)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
339 (when (interactive-p) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
340 (pgg-display-output-buffer start end status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
341 status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
342 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
343 ;;;###autoload |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
344 (defun pgg-encrypt-symmetric (&optional start end passphrase) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
345 "Encrypt the current buffer using a symmetric, rather than key-pair, cipher. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
346 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
347 If optional arguments START and END are specified, only encrypt within |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
348 the region. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
349 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
350 If optional PASSPHRASE is not specified, it will be obtained from the |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
351 passphrase cache or user." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
352 (interactive) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
353 (let* ((start (or start (point-min))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
354 (end (or end (point-max))) |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
355 (status (pgg-encrypt-symmetric-region start end passphrase))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
356 (when (interactive-p) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
357 (pgg-display-output-buffer start end status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
358 status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
359 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
360 ;;;###autoload |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
361 (defun pgg-encrypt (rcpts &optional sign start end passphrase) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
362 "Encrypt the current buffer for RCPTS. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
363 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
364 If optional argument SIGN is non-nil, do a combined sign and encrypt. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
365 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
366 If optional arguments START and END are specified, only encrypt within |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
367 the region. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
368 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
369 If optional PASSPHRASE is not specified, it will be obtained from the |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
370 passphrase cache or user." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
371 (interactive (list (split-string (read-string "Recipients: ") "[ \t,]+"))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
372 (let* ((start (or start (point-min))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
373 (end (or end (point-max))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
374 (status (pgg-encrypt-region start end rcpts sign passphrase))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
375 (when (interactive-p) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
376 (pgg-display-output-buffer start end status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
377 status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
378 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
379 ;;;###autoload |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
380 (defun pgg-decrypt-region (start end &optional passphrase) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
381 "Decrypt the current region between START and END. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
382 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
383 If optional PASSPHRASE is not specified, it will be obtained from the |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
384 passphrase cache or user." |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
385 (interactive "r") |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
386 (let* ((buf (current-buffer)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
387 (status |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
388 (pgg-save-coding-system start end |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
389 (pgg-invoke "decrypt-region" (or pgg-scheme pgg-default-scheme) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
390 (point-min) (point-max) passphrase)))) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
391 (when (interactive-p) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
392 (pgg-display-output-buffer start end status)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
393 status)) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
394 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
395 ;;;###autoload |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
396 (defun pgg-decrypt (&optional start end passphrase) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
397 "Decrypt the current buffer. |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
398 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
399 If optional arguments START and END are specified, only decrypt within |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
400 the region. |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
401 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
402 If optional PASSPHRASE is not specified, it will be obtained from the |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
403 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
404 (interactive "") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
405 (let* ((start (or start (point-min))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
406 (end (or end (point-max))) |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
407 (status (pgg-decrypt-region start end passphrase))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
408 (when (interactive-p) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
409 (pgg-display-output-buffer start end status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
410 status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
411 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
412 ;;;###autoload |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
413 (defun pgg-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
|
414 "Make the signature from text between START and END. |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
415 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
416 If the optional 3rd argument CLEARTEXT is non-nil, it does not create |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
417 a detached signature. |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
418 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
419 If this function is called interactively, CLEARTEXT is enabled |
77932
491c39d86dc0
(pgg-sign-region, pgg-sign): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
420 and the output is displayed. |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
421 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
422 If optional PASSPHRASE is not specified, it will be obtained from the |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
423 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
424 (interactive "r") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
425 (let ((status (pgg-save-coding-system start end |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
426 (pgg-invoke "sign-region" (or pgg-scheme pgg-default-scheme) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
427 (point-min) (point-max) |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
428 (or (interactive-p) cleartext) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
429 passphrase)))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
430 (when (interactive-p) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
431 (pgg-display-output-buffer start end status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
432 status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
433 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
434 ;;;###autoload |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
435 (defun pgg-sign (&optional cleartext start end passphrase) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
436 "Sign the current buffer. |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
437 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
438 If the optional argument CLEARTEXT is non-nil, it does not create a |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
439 detached signature. |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
440 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
441 If optional arguments START and END are specified, only sign data |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
442 within the region. |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
443 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
444 If this function is called interactively, CLEARTEXT is enabled |
77932
491c39d86dc0
(pgg-sign-region, pgg-sign): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
445 and the output is displayed. |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
446 |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
447 If optional PASSPHRASE is not specified, it will be obtained from the |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
448 passphrase cache or user." |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
449 (interactive "") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
450 (let* ((start (or start (point-min))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
451 (end (or end (point-max))) |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
452 (status (pgg-sign-region start end |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
453 (or (interactive-p) cleartext) |
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
454 passphrase))) |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
455 (when (interactive-p) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
456 (pgg-display-output-buffer start end status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
457 status)) |
66519
20539524a670
(pgg-decrypt): Passing along 'passphrase' in call to pgg-decrypt-region.
Eli Zaretskii <eliz@gnu.org>
parents:
66383
diff
changeset
|
458 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
459 ;;;###autoload |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
460 (defun pgg-verify-region (start end &optional signature fetch) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
461 "Verify 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
|
462 If the optional 3rd argument SIGNATURE is non-nil, it is treated as |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
463 the detached signature of the current region. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
464 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
465 If the optional 4th argument FETCH is non-nil, we attempt to fetch the |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
466 signer's public key from `pgg-default-keyserver-address'." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
467 (interactive "r") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
468 (let* ((packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
469 (if (null signature) nil |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
470 (with-temp-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
471 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
472 (if (fboundp 'set-buffer-multibyte) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
473 (set-buffer-multibyte nil)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
474 (insert-file-contents signature) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
475 (cdr (assq 2 (pgg-decode-armor-region |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
476 (point-min)(point-max))))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
477 (key (cdr (assq 'key-identifier packet))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
478 status keyserver) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
479 (and (stringp key) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
480 pgg-query-keyserver |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
481 (setq key (concat "0x" (pgg-truncate-key-identifier key))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
482 (null (pgg-lookup-key key)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
483 (or fetch (interactive-p)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
484 (y-or-n-p (format "Key %s not found; attempt to fetch? " key)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
485 (setq keyserver |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
486 (or (cdr (assq 'preferred-key-server packet)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
487 pgg-default-keyserver-address)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
488 (pgg-fetch-key keyserver key)) |
77932
491c39d86dc0
(pgg-sign-region, pgg-sign): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
489 (setq status |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
490 (pgg-save-coding-system start end |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
491 (pgg-invoke "verify-region" (or pgg-scheme pgg-default-scheme) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
492 (point-min) (point-max) signature))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
493 (when (interactive-p) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
494 (let ((temp-buffer-show-function |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
495 (function pgg-temp-buffer-show-function))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
496 (with-output-to-temp-buffer pgg-echo-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
497 (set-buffer standard-output) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
498 (insert-buffer-substring (if status pgg-output-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
499 pgg-errors-buffer))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
500 status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
501 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
502 ;;;###autoload |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
503 (defun pgg-verify (&optional signature fetch start end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
504 "Verify the current buffer. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
505 If the optional argument SIGNATURE is non-nil, it is treated as |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
506 the detached signature of the current region. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
507 If the optional argument FETCH is non-nil, we attempt to fetch the |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
508 signer's public key from `pgg-default-keyserver-address'. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
509 If optional arguments START and END are specified, only verify data |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
510 within the region." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
511 (interactive "") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
512 (let* ((start (or start (point-min))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
513 (end (or end (point-max))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
514 (status (pgg-verify-region start end signature fetch))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
515 (when (interactive-p) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
516 (let ((temp-buffer-show-function |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
517 (function pgg-temp-buffer-show-function))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
518 (with-output-to-temp-buffer pgg-echo-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
519 (set-buffer standard-output) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
520 (insert-buffer-substring (if status pgg-output-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
521 pgg-errors-buffer))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
522 status)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
523 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
524 ;;;###autoload |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
525 (defun pgg-insert-key () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
526 "Insert the ASCII armored public key." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
527 (interactive) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
528 (pgg-invoke "insert-key" (or pgg-scheme pgg-default-scheme))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
529 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
530 ;;;###autoload |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
531 (defun pgg-snarf-keys-region (start end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
532 "Import public keys in 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
|
533 (interactive "r") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
534 (pgg-save-coding-system start end |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
535 (pgg-invoke "snarf-keys-region" (or pgg-scheme pgg-default-scheme) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
536 start end))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
537 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
538 ;;;###autoload |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
539 (defun pgg-snarf-keys () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
540 "Import public keys in the current buffer." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
541 (interactive "") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
542 (pgg-snarf-keys-region (point-min) (point-max))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
543 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
544 (defun pgg-lookup-key (string &optional type) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
545 (pgg-invoke "lookup-key" (or pgg-scheme pgg-default-scheme) string type)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
546 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
547 (defvar pgg-insert-url-function (function pgg-insert-url-with-w3)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
548 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
549 (defun pgg-insert-url-with-w3 (url) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
550 (ignore-errors |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
551 (require 'url) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
552 (let (buffer-file-name) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
553 (url-insert-file-contents url)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
554 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
555 (defvar pgg-insert-url-extra-arguments nil) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
556 (defvar pgg-insert-url-program nil) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
557 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
558 (defun pgg-insert-url-with-program (url) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
559 (let ((args (copy-sequence pgg-insert-url-extra-arguments)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
560 process) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
561 (insert |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
562 (with-temp-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
563 (setq process |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
564 (apply #'start-process " *PGG url*" (current-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
565 pgg-insert-url-program (nconc args (list url)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
566 (set-process-sentinel process #'ignore) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
567 (while (eq 'run (process-status process)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
568 (accept-process-output process 5)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
569 (delete-process process) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
570 (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
|
571 (interrupt-process process)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
572 (buffer-string))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
573 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
574 (defun pgg-fetch-key (keyserver key) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
575 "Attempt to fetch a KEY from KEYSERVER for addition to PGP or GnuPG keyring." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
576 (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
|
577 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
578 (erase-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
579 (let ((proto (if (string-match "^[a-zA-Z\\+\\.\\\\-]+:" keyserver) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
580 (substring keyserver 0 (1- (match-end 0)))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
581 (save-excursion |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
582 (funcall pgg-insert-url-function |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
583 (if proto keyserver |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
584 (format "http://%s:11371/pks/lookup?op=get&search=%s" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
585 keyserver key)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
586 (when (re-search-forward "^-+BEGIN" nil 'last) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
587 (delete-region (point-min) (match-beginning 0)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
588 (when (re-search-forward "^-+END" nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
589 (delete-region (progn (end-of-line) (point)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
590 (point-max))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
591 (insert "\n") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
592 (with-temp-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
593 (insert-buffer-substring pgg-output-buffer) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
594 (pgg-snarf-keys-region (point-min)(point-max))))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
595 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
596 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
597 (provide 'pgg) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
598 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
599 ;;; arch-tag: 9cc705dd-1e6a-4c90-8dce-c3561f9a2cf4 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
600 ;;; pgg.el ends here |