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

Re: PGP and SMIME support



Hi,

> I got gpg encryption and signing working, however I can't figure out
> how to automatically decrypt and verify received messages, and how
> to setup automatic encryption if a key is available.

I use modified SEMI (*1) which use EasyPG and I use the below code for
automatic verification.  It may run with original SEMI If you can use
EasyPG.  I have never tried automatic decryption, encryption and
signing.

(*1) https://github.com/ikazuhiro/semi-epg

(eval-after-load "mime-view"
  '(progn
     (defun mime-preview-application/*-signature (entity situation)
       (let* ((mother (mime-entity-parent entity))
	      (orig-entity (car (mime-entity-children mother)))
	      (protocol (cdr (assoc "protocol" (mime-entity-parameters mother))))
	      (context (epg-make-context
			(if (equal protocol "application/pgp-signature")
			    'OpenPGP
			  (if (string-match
			       "\\`application/\\(x-\\)?pkcs7-signature\\'"
			       protocol)
			      'CMS
			    (error "Unknown protocol: %s" protocol)))))
	      verify-result)
	 (epg-verify-string context
			    (mime-entity-content entity)
			    (with-temp-buffer
			      (if (fboundp 'set-buffer-multibyte)
				  (set-buffer-multibyte nil))
			      (mime-insert-entity orig-entity)
			      (goto-char (point-min))
			      (while (search-forward "\n" nil t)
				(replace-match "\r\n"))
			      (buffer-substring (point-min) (point-max))))
	 (setq verify-result (epg-context-result-for context 'verify))
	 (when verify-result
	   (insert (epg-verify-result-to-string verify-result)))))
     (ctree-set-calist-strictly
      'mime-preview-condition
      '((type . application)
	(subtype . pgp-signature)
	(body . visible)
	(body-presentation-method . mime-preview-application/*-signature)))))

>  For S/MIME, I haven't found anything, it seems there's
> <mime-edit-enclose-smime-signed-region> in mime-edit.el (semi) for
> creating smime-signed regions, however that method doesn't work, as
> it calls <smime-encrypt-region> (line 2037) with two parameters, but
> that method expects three (the signing keys are missing).

See David Maus' report (*2).  If you use smime.el with only Wanderlust
(SEMI) and you have smime executable (I don't know where is),
installing SEMI derived smime.el may avoid the problem.

(*2) http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586003

Or, My modified SEMI or emiko-1.14.1-for-epg-0.0.13 (*3) may avoid this
problem, but I have never used S/MIME.

(*3) http://sourceforge.jp/projects/epg/releases/?package_id=4840

-- 
Kazuhiro Ito