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

Re: S/MIME with Wanderlust



> 1. I extracted the smime.p7s attachment by the methods you specified.
> Both of dem worked to save the file.
> 
> 2. I executed the epg-decrypt-file function as you told me.
> It worked strait away with the same output to *Messages* as the command line (see posting below)
> 
> 3. Yes, correctly decrypted string is there to be read in plain text. 
> It is exactly "kdlsido gggg” (not very meaningful tough :-)
> 
> 4. I checked also the temp file created from function as given below.
> The file is ok and has exactly the same content as my posting from the *Messages* buffer (see below)
> 
> After all, it seems the problem is (still and only) extracting the right section of "Content-Type: text/plain;” .

Thank you for testing.  This result is normal.  But, because
epg-decrypt-file and epg-decrypt-string (used by
mime-view-application/pkcs7-mime) have almost same algorithm for
communicating gpgsm, I can't understand the cause of your problem.

Please check epg-decrypt-string function according to the below
procedure.

1. Evaluate the below code to override
mime-view-application/pkcs7-mime function.

(progn
  (require 'mime-pgp)
  (defun mime-view-application/pkcs7-mime (entity situation)
    (let* ((p-win (or (get-buffer-window (current-buffer))
		      (get-largest-window)))
	   (new-name
	    (format "%s-%s" (buffer-name) (mime-entity-number entity)))
	   (mother (current-buffer))
	   (preview-buffer (concat "*Preview-" (buffer-name) "*"))
	   (context (epg-make-context 'CMS))
	   message-buf)
      (when (memq (or (cdr (assq 'smime-type situation)) 'enveloped-data)
		  '(enveloped-data signed-data))
	(set-buffer (setq message-buf (get-buffer-create new-name)))
	(let ((inhibit-read-only t)
	      buffer-read-only)
	  (erase-buffer)
	  (insert (epg-decrypt-string context (mime-entity-content entity)))
	  (goto-char (point-min))
	  (set-window-buffer nil (current-buffer))
	  (let ((cursor-in-echo-area t))
	    (read-key "Proceed? "))
	  )
	(setq major-mode 'mime-show-message-mode)
	(save-window-excursion
	  (mime-view-buffer nil preview-buffer mother
			    nil 'binary)
	  (make-local-variable 'mime-view-temp-message-buffer)
	  (setq mime-view-temp-message-buffer message-buf))
	(message "Done!!"))))
  )

2. Decrypt your application/pkcs7-mime part by
mime-view-application/pkcs7-mime function.  Decryptred raw content
(buffer named like " *WL:Message*-nil") and "Proceed? " prompt should
be displayed.

3. Confirm whether decrypted raw content is corrupted.  Don't touch
any key until you have confirmed.

4. Hit any normal key to proceed.  After preview buffer is generated
(but not displayed), "Done!!" message showed in minibuffer.

5. Confirm whether decrypted raw content is corrupted or modified.

5. Swith to preview buffer (buffer named like
"*Preview- *WL:Message**") and confirm how decrypted content is
displayed.

-- 
Kazuhiro Ito