unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Alexander Adolf <alexander.adolf@condition-alpha.com>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Subject: Re: emacs: error decrypting s/mime
Date: Tue, 22 Dec 2020 21:19:21 +0100	[thread overview]
Message-ID: <317b3e3799837416740c1b736e02ceea@condition-alpha.com> (raw)
In-Reply-To: <878sb55vcp.fsf@tethera.net>

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

      parent reply	other threads:[~2020-12-22 20:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 23:51 emacs: error decrypting s/mime Alexander Adolf
2020-09-11 21:32 ` Alexander Adolf
2020-09-12 10:17 ` David Bremner
2020-11-12 14:26 ` David Bremner
2020-11-13  0:13   ` David Bremner
2020-11-13 11:50     ` David Bremner
2020-11-17 23:25       ` Alexander Adolf
2020-12-14 22:20       ` Alexander Adolf
2020-12-14 22:42         ` Alexander Adolf
2020-12-22 20:19       ` Alexander Adolf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=317b3e3799837416740c1b736e02ceea@condition-alpha.com \
    --to=alexander.adolf@condition-alpha.com \
    --cc=david@tethera.net \
    --cc=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).