Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Verifying pkcs7-mime messages -- patch
@ 2005-04-06 11:37 Milan Zamazal
  0 siblings, 0 replies; only message in thread
From: Milan Zamazal @ 2005-04-06 11:37 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 80 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mm-view.el.patch --]
[-- Type: text/x-patch, Size: 1409 bytes --]

--- 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)

[-- Attachment #3: Type: text/plain, Size: 338 bytes --]


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-06 11:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-06 11:37 Verifying pkcs7-mime messages -- patch Milan Zamazal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).