info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Verifying pkcs7-mime messages -- patch


From: Milan Zamazal
Subject: Verifying pkcs7-mime messages -- patch
Date: Wed, 06 Apr 2005 13:37:56 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

The following patch against Emacs CVS makes Gnus verify pkcs7-mime
signatures:

--- mm-view.el.orig     2005-04-05 18:05:25.599196219 +0200
+++ mm-view.el  2005-04-05 18:03:59.177559850 +0200
@@ -538,18 +538,24 @@
 
 (defun mm-view-pkcs7-verify (handle)
   ;; A bogus implementation of PKCS#7. FIXME::
-  (mm-insert-part handle)
-  (goto-char (point-min))
-  (if (search-forward "Content-Type: " nil t)
-      (delete-region (point-min) (match-beginning 0)))
-  (goto-char (point-max))
-  (if (re-search-backward "--\r?\n?" nil t)
-      (delete-region (match-end 0) (point-max)))
+  (let ((verified nil))
+    (with-temp-buffer
+      (insert "MIME-Version: 1.0\n")
+      (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
+      (insert-buffer-substring (mm-handle-buffer handle))
+      (setq verified (smime-verify-region (point-min) (point-max))))
+    (goto-char (point-min))
+    (mm-insert-part handle)
+    (if (search-forward "Content-Type: " nil t)
+        (delete-region (point-min) (match-beginning 0)))
+    (goto-char (point-max))
+    (if (re-search-backward "--\r?\n?" nil t)
+        (delete-region (match-end 0) (point-max)))
+    (unless verified
+      (insert-buffer-substring smime-details-buffer)))
   (goto-char (point-min))
   (while (search-forward "\r\n" nil t)
     (replace-match "\n"))
-  (message "Verify signed PKCS#7 message is unimplemented.")
-  (sit-for 1)
   t)
 
 (autoload 'gnus-completing-read-maybe-default "gnus-util" nil nil 'macro)
Regards,

Milan Zamazal

-- 
If we are going to start removing packages because of the quality of the
software, wonderful.  I move to remove all traces of the travesty of editors,
vi, from Debian, since obviously as editors they are less than alpha quality
software.                                   -- Manoj Srivastava in debian-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]