1 ;;; mml1991.el --- Old PGP message format (RFC 1991) support for MML
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
4 ;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
6 ;; Author: Sascha Lüdecke <sascha@meta-x.de>,
7 ;; Simon Josefsson <simon@josefsson.org> (Mailcrypt interface, Gnus glue)
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
31 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))
33 (if (locate-library "password-cache")
34 (require 'password-cache)
44 (defvar mc-pgp-always-sign)
46 (autoload 'quoted-printable-decode-region "qp")
47 (autoload 'quoted-printable-encode-region "qp")
49 (autoload 'mm-decode-content-transfer-encoding "mm-bodies")
50 (autoload 'mm-encode-content-transfer-encoding "mm-bodies")
51 (autoload 'message-options-get "message")
52 (autoload 'message-options-set "message")
54 (defvar mml1991-use mml2015-use
55 "The package used for PGP.")
57 (defvar mml1991-function-alist
58 '((mailcrypt mml1991-mailcrypt-sign
59 mml1991-mailcrypt-encrypt)
64 "Alist of PGP functions.")
66 (defvar mml1991-cache-passphrase mml-secure-cache-passphrase
67 "If t, cache passphrase.")
69 (defvar mml1991-passphrase-cache-expiry mml-secure-passphrase-cache-expiry
70 "How many seconds the passphrase is cached.
71 Whether the passphrase is cached at all is controlled by
72 `mml1991-cache-passphrase'.")
74 (defvar mml1991-signers nil
75 "A list of your own key ID which will be used to sign a message.")
77 (defvar mml1991-encrypt-to-self nil
78 "If t, add your own key ID to recipient list when encryption.")
82 (autoload 'mc-sign-generic "mc-toplev")
84 (defvar mml1991-decrypt-function 'mailcrypt-decrypt)
85 (defvar mml1991-verify-function 'mailcrypt-verify)
87 (defun mml1991-mailcrypt-sign (cont)
88 (let ((text (current-buffer))
90 (result-buffer (get-buffer-create "*GPG Result*")))
91 ;; Save MIME Content[^ ]+: headers from signing
92 (goto-char (point-min))
93 (while (looking-at "^Content[^ ]+:") (forward-line))