All right ― we will get there! 1. executed 2. exactly as expected by you 3. OK! Buffer *WL:Message*-nil shows decrypted raw content just as posted in my last mail (see below again). It has both parts, the text/plain and the pkcs7-signature. 4. ‘Done' message displayed in mini buffer 5. Buffer *WL:Message*-nil did not change. Raw content exactly like in step 3. (OK) 6. Switch to *Preview- *WL:Message* and there the content is only the second part of the raw content "Content-Type: application/pkcs7-signature;” So, here we are again, the preview buffer selects the wrong part of the raw content. Yours best, mc Beginning of output in step 3 and 5: Content-Type: multipart/signed; boundary="Apple-Mail=_51A03F47-92BB-4FDC-BA9B-FFE147223058"; protocol="application/pkcs7-signature"; micalg=sha1 --Apple-Mail=_51A03F47-92BB-4FDC-BA9B-FFE147223058 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii kdlsido gggg --Apple-Mail=_51A03F47-92BB-4FDC-BA9B-FFE147223058 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIFBzCCBQMw ggProAMCAQICAQcwCwYJKoZIhvcNAQELMIIBHTELMAkGA1UEAwwCTUMxGzAZBgNVBAoMEs6gzpXO nc6kzpHOpc6bzp/OmTGBlzCBlAYDVQQLDIGMzqDPgc+MzrPPgc6xzrzOvM6xIM6jz4XPg8+Ezq7O (snip) On 01.02.2014, at 09:41, Kazuhiro Ito <kzhr@d1.dion.ne.jp> wrote: >> 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 >
Attachment:
smime.p7s
Description: S/MIME cryptographic signature