Re: emacs: error decrypting s/mime

Subject: Re: emacs: error decrypting s/mime

Date: Tue, 22 Dec 2020 21:19:21 +0100

To: David Bremner, notmuch@notmuchmail.org

Cc: Daniel Kahn Gillmor

From: Alexander Adolf


Hello David,

David Bremner <david@tethera.net> writes:

> David Bremner <david@tethera.net> writes:
>
>> It's not perfect (the encryption status for S/MIME needs some new UI
>> code on the emacs end), but it's better than the status quo, as far as I
>> can tell.
>
> I think this might be a deeper issue. Looking at the structure of
>
>   test/corpora/protected-headers/smime-sign+enc.eml
>
> it looks like there is an application/pkcs-7 part for the outer
> container with an encstatus, and one inside that (with the same mime
> type) with a sigstatus. So maybe the right thing is to just ignore
> missing encstatus?
> [...]

After decrypting (i.e. when you see the encstatus), and the decryption
was successful (encstatus is not "bad"), the application/pkcs7-mime part
has been expanded into a multipart/signed part. This, in turn, then
needs to be rendered.

In short, the below snippet fixes the issue for me. It could for example
be added to notmuch-show.el.

---------------------------- Begin Quote -----------------------------

(defun notmuch-show-insert-part-application/pkcs7-mime (msg part content-type nth depth button)
  (let* ((encstatus-plist (car (plist-get part :encstatus)))
	 (encstatus (plist-get encstatus-plist :status)))
      (notmuch-crypto-insert-encstatus-button encstatus-plist)
      (if (not (string= encstatus "bad"))
	  (notmuch-show-insert-part-multipart/signed msg
						     (car (plist-get part :content))
						     content-type
						     nth
						     depth
						     button))))

(fset 'notmuch-show-insert-part-application/x-pkcs7-mime
  'notmuch-show-insert-part-application/pkcs7-mime)

----------------------------- End Quote ------------------------------


Hoping to have helped,

  --alexander
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: