X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fmml-sec.el;h=d4433c9ad5ba4cf85a1bbb73156d18340b823abb;hb=e53007228003522860c20f231785d61d35b7312b;hp=11c8b160aa9d2f42415f14e065058216e9ce2921;hpb=20bc985a3232ebba106d335afcfd6b596bb8efba;p=gnus diff --git a/lisp/mml-sec.el b/lisp/mml-sec.el index 11c8b160a..d4433c9ad 100644 --- a/lisp/mml-sec.el +++ b/lisp/mml-sec.el @@ -1,5 +1,7 @@ ;;; mml-sec.el --- A package with security functions for MML documents -;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +;; Copyright (C) 2000, 2001, 2002, 2003, 2004, +;; 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Simon Josefsson @@ -24,14 +26,20 @@ ;;; Code: -(require 'mml-smime) (eval-when-compile (require 'cl)) +(require 'password) (autoload 'mml2015-sign "mml2015") (autoload 'mml2015-encrypt "mml2015") (autoload 'mml1991-sign "mml1991") (autoload 'mml1991-encrypt "mml1991") (autoload 'message-goto-body "message") (autoload 'mml-insert-tag "mml") +(autoload 'mml-smime-sign "mml-smime") +(autoload 'mml-smime-encrypt "mml-smime") +(autoload 'mml-smime-sign-query "mml-smime") +(autoload 'mml-smime-encrypt-query "mml-smime") +(autoload 'mml-smime-verify "mml-smime") +(autoload 'mml-smime-verify-test "mml-smime") (defvar mml-sign-alist '(("smime" mml-smime-sign-buffer mml-smime-sign-query) @@ -94,6 +102,23 @@ details." (choice (const :tag "Separate" separate) (const :tag "Combined" combined))))) +(defcustom mml-secure-verbose nil + "If non-nil, ask the user about the current operation more verbosely." + :group 'message + :type 'boolean) + +(defcustom mml-secure-cache-passphrase password-cache + "If t, cache passphrase." + :group 'message + :type 'boolean) + +(defcustom mml-secure-passphrase-cache-expiry password-cache-expiry + "How many seconds the passphrase is cached. +Whether the passphrase is cached at all is controlled by +`mml-secure-cache-passphrase'." + :group 'message + :type 'integer) + ;;; Configuration/helper functions (defun mml-signencrypt-style (method &optional style) @@ -186,6 +211,29 @@ You can also customize or set `mml-signencrypt-style-alist' instead." (cons method tags)))) (t (error "The message is corrupted. No mail header separator")))))) +(defvar mml-secure-method + (if (equal mml-default-encrypt-method mml-default-sign-method) + mml-default-sign-method + "pgpmime") + "Current security method. Internal variable.") + +(defun mml-secure-sign (&optional method) + "Add MML tags to sign this MML part. +Use METHOD if given. Else use `mml-secure-method' or +`mml-default-sign-method'." + (interactive) + (mml-secure-part + (or method mml-secure-method mml-default-sign-method) + 'sign)) + +(defun mml-secure-encrypt (&optional method) + "Add MML tags to encrypt this MML part. +Use METHOD if given. Else use `mml-secure-method' or +`mml-default-sign-method'." + (interactive) + (mml-secure-part + (or method mml-secure-method mml-default-sign-method))) + (defun mml-secure-sign-pgp () "Add MML tags to PGP sign this MML part." (interactive) @@ -254,6 +302,34 @@ You can also customize or set `mml-signencrypt-style-alist' instead." (when (re-search-backward "^<#secure.*>\n" nil t) (delete-region (match-beginning 0) (match-end 0))))) + +(defun mml-secure-message-sign (&optional method) + "Add MML tags to sign this MML part. +Use METHOD if given. Else use `mml-secure-method' or +`mml-default-sign-method'." + (interactive) + (mml-secure-part + (or method mml-secure-method mml-default-sign-method) + 'sign)) + +(defun mml-secure-message-sign-encrypt (&optional method) + "Add MML tag to sign and encrypt the entire message. +Use METHOD if given. Else use `mml-secure-method' or +`mml-default-sign-method'." + (interactive) + (mml-secure-message + (or method mml-secure-method mml-default-sign-method) + 'signencrypt)) + +(defun mml-secure-message-encrypt (&optional method) + "Add MML tag to encrypt the entire message. +Use METHOD if given. Else use `mml-secure-method' or +`mml-default-sign-method'." + (interactive) + (mml-secure-message + (or method mml-secure-method mml-default-sign-method) + 'encrypt)) + (defun mml-secure-message-sign-smime () "Add MML tag to encrypt/sign the entire message." (interactive)