Importing Oort Gnus v0.04.
[elisp/gnus.git-] / lisp / mml-sec.el
index cc54995..3d30602 100644 (file)
 
 ;;; Code:
 
-(require 'smime)
 (require 'mml2015)
+(require 'mml1991)
 (require 'mml-smime)
 (eval-when-compile (require 'cl))
 
 (defvar mml-sign-alist
   '(("smime"     mml-smime-sign-buffer     mml-smime-sign-query)
+    ("pgp"       mml-pgp-sign-buffer       list)
     ("pgpmime"   mml-pgpmime-sign-buffer   list))
   "Alist of MIME signer functions.")
 
@@ -38,6 +39,7 @@
 
 (defvar mml-encrypt-alist
   '(("smime"     mml-smime-encrypt-buffer     mml-smime-encrypt-query)
+    ("pgp"       mml-pgp-encrypt-buffer       list)
     ("pgpmime"   mml-pgpmime-encrypt-buffer   list))
   "Alist of MIME encryption functions.")
 
   (or (mml-smime-encrypt cont)
       (error "Encryption failed... inspect message logs for errors")))
 
+(defun mml-pgp-sign-buffer (cont)
+  (or (mml1991-sign cont)
+      (error "Signing failed... inspect message logs for errors")))
+
+(defun mml-pgp-encrypt-buffer (cont)
+  (or (mml1991-encrypt cont)
+      (error "Encryption failed... inspect message logs for errors")))
+
 (defun mml-pgpmime-sign-buffer (cont)
   (or (mml2015-sign cont)
       (error "Signing failed... inspect message logs for errors")))
                   (when (string-match "[\"'\\~/*;() \t\n]" value)
                     (setq value (prin1-to-string value)))
                   (insert (format " %s=%s" key value))))))
-           ((or (re-search-backward 
+           ((or (re-search-backward
                  (concat "^" (regexp-quote mail-header-separator) "\n") nil t)
                 (re-search-forward
                  (concat "^" (regexp-quote mail-header-separator) "\n") nil t))
             (goto-char (match-end 0))
             (apply 'mml-insert-tag 'part (cons (if sign 'sign 'encrypt)
                                                (cons method tags))))
-           (t (error "The message is corrupted. No mail header separator."))))))
+           (t (error "The message is corrupted. No mail header separator"))))))
+
+(defun mml-secure-sign-pgp ()
+  "Add MML tags to PGP sign this MML part."
+  (interactive)
+  (mml-secure-part "pgp" 'sign))
 
 (defun mml-secure-sign-pgpmime ()
   "Add MML tags to PGP/MIME sign this MML part."
   (interactive)
   (mml-secure-part "smime" 'sign))
 
+(defun mml-secure-encrypt-pgp ()
+  "Add MML tags to PGP encrypt this MML part."
+  (interactive)
+  (mml-secure-part "pgp"))
+
 (defun mml-secure-encrypt-pgpmime ()
   "Add MML tags to PGP/MIME encrypt this MML part."
   (interactive)