Dear Notmuch Developers, I have trouble getting going with S/MIME. Emacs version: GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2020-08-12 notmuch version: notmuch 0.31+2~gd127b16 (brew install notmuch --head) gpgsm version: gpgsm (GnuPG) 2.2.23 libgcrypt 1.8.6 libksba 1.4.0 When I send an encrypted and signed message to myself, the sending works as expected. When I open the message in emacs from a notmuch search, the gnupg password agent pops up, and asks for the passphrase for my secret key. Once the password agent dialogue is finished (I entered the passphrase), emacs switches to a notmuch-show buffer with the message. The body part of the message however only shows "[ smime.p7m: application/pkcs7-mime ]", nothing else. I then hit the "$" key twice to turn processing for cryptographic MIME parts off, and on again. After the second "$", the gnupg password agent comes up again. I enter the passphrase, and the following appears in the notmuch-show buffer: ---------------------------- Begin Quote ----------------------------- !!! Bodypart handler `notmuch-show-insert-part-*/*' threw an error: !!! Wrong type argument: char-or-string-p, ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C6640636F6E646974696F6E2D616C7068612E636F6D,CN=Alexander Adolf,O=Condition-ALPHA Digital Broadcast Technology Consulting,L=Munich,C=DE")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ((:id 4 :content-type "text/plain" :content-disposition "inline" :content "Earlier patches have moved the handling of wash fake inline patch parts to insert-bodypart so we can drop the function notmuch-show-insert-part-inline-patch-fake-part "))) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) ----------------------------- End Quote ------------------------------ The actual message content seems to have been decrypted ok (it shows up as the text/plain part in the dumped function arguments). Also, I can open the message without problems in the Apple Mail.app that ships with macOS (shows the same decrypted content, and a good signature). Many thanks and looking forward to your thoughts, --alexander
Hello again, for what it's worth, and hoping that it helps track down the problem, here is the elisp debugger backtrace for the situation I described (hitting "$" twice): ---------------------------- Begin Quote ----------------------------- Debugger entered--Lisp error: (wrong-type-argument char-or-string-p ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ((:id 4 :content-type "text/plain" :content-disposition "inline" :content "Earlier patches have moved the handling of wash fa..."))) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478))))) notmuch-mm-display-part-inline((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ...) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) (:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ((:id 4 :content-type "text/plain" :content-disposition "inline" :content "Earlier patches have moved the handling of wash fa..."))) (:id 5 :content- type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime") "application/pkcs7-mime" t) notmuch-show-insert-part-*/*((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ...) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status (( :status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) (:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ((:id 4 :content-type "text/plain" :content-disposition "inline" :content "Earlier patches have moved the handling of wash fa..."))) (:id 5 :content-ty pe "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime") "application/pkcs7-mime" 1 0 #<overlay from 219 to 256 in *s/mime 2*>) notmuch-show-insert-bodypart-internal((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ...) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime")) :crypto (:signed (: status ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) (:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ((:id 4 :content-type "text/plain" :content-disposition "inline" :content "Earlier patches have moved the handling of wash fa..."))) (:id 5 :c ontent-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime") "application/pkcs7-mime" 1 0 #<overlay from 219 to 256 in *s/mime 2*>) notmuch-show-insert-bodypart((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ...) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status (( :status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) (:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ((:id 4 :content-type "text/plain" :content-disposition "inline" :content "Earlier patches have moved the handling of wash fa..."))) (:id 5 :content-ty pe "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime") 0) #f(compiled-function (part) #<bytecode 0x1fe852d14aed>)((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ((:id 4 :content-type "text/plain" :content-disposition "inline" :content "Earlier patches have moved the handling of wash fa..."))) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime")) mapc(#f(compiled-function (part) #<bytecode 0x1fe852d14aed>) ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content (...)) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime"))) notmuch-show-insert-body((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ...) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status ((:sta tus "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content (...)) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :con tent-length 4478)))) :computed-type "application/pkcs7-mime")) 0) notmuch-show-insert-msg((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :content-type "multipart/signed" :content ((:id 3 :content-type "multipart/mixed" :content ...) (:id 5 :content-type "application/pkcs7-signature" :content-disposition "attachment" :filename "smime.p7s" :content-transfer-encoding "base64" :content-length 4478)))) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status ((:stat us "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) 0) notmuch-show-insert-tree(((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus (...) :content-type "multipart/signed" :content (... ...))) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) nil) 0) #f(compiled-function (tree) #<bytecode 0x1fe852d14c1d>)(((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus (...) :content-type "multipart/signed" :content (... ...))) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <al exander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) nil)) mapc(#f(compiled-function (tree) #<bytecode 0x1fe852d14c1d>) (((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ... :content-type "multipart/signed" :content ...)) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alex ander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) nil))) notmuch-show-insert-thread((((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ... :content-type "multipart/signed" :content ...)) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Se p 2020 01:15:24 +0200")) nil)) 0) #f(compiled-function (thread) #<bytecode 0x1fe852d14c45>)((((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus ((:status "good")) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content ((:id 2 :sigstatus ... :content-type "multipart/signed" :content ...)) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status ((:status "good" :fingerprint "142AFE91C66D710592AF9D90A1385D251FEC65B7" :created 1599693325 :expires 1631218144 :userid "1.2.840.113549.1.9.1=#616C6578616E6465722E61646F6C...")) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexand er.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) nil))) mapc(#f(compiled-function (thread) #<bytecode 0x1fe852d14c45>) ((((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus (...) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content (...) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status (...) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) nil)))) notmuch-show-insert-forest(((((:id "a4c9fd548b26cdcd20ec8b05bc4507da@condition-alpha.c..." :match t :excluded nil :filename ("/Users/alexanderadolf/Library/Mail/Maildir/imap-ac..." "/Users/alexanderadolf/Library/Mail/Maildir/archive...") :timestamp 1599693324 :date_relative "Yest. 01:15" :tags ("encrypted" "inbox") :body ((:id 1 :encstatus (...) :content-type "application/pkcs7-mime" :content-disposition "attachment" :filename "smime.p7m" :content (...) :computed-type "application/pkcs7-mime")) :crypto (:signed (:status (...) :encrypted t) :decrypted (:status "full")) :headers (:Subject "s/mime 2" :From "Alexander Adolf <alexander.adolf@condition-alpha.c..." :To "\"Dipl.-Ing.(FH) Alexander Adolf\" <alexander.adolf@..." :Date "Thu, 10 Sep 2020 01:15:24 +0200")) nil)))) notmuch-show--build-buffer((((#<window 6 on *s/mime 2*> "id:a4c9fd548b26cdcd20ec8b05bc4507da@condition-alph...")) ("id:a4c9fd548b26cdcd20ec8b05bc4507da@condition-alph..."))) notmuch-show-refresh-view() notmuch-show-toggle-process-crypto() funcall-interactively(notmuch-show-toggle-process-crypto) call-interactively(notmuch-show-toggle-process-crypto nil nil) command-execute(notmuch-show-toggle-process-crypto) ----------------------------- End Quote ------------------------------
[-- Attachment #1: Type: text/plain, Size: 737 bytes --] Alexander Adolf <alexander.adolf@condition-alpha.com> writes: > Dear Notmuch Developers, > > I have trouble getting going with S/MIME. > > Emacs version: GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS > appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2020-08-12 > > notmuch version: notmuch 0.31+2~gd127b16 > (brew install notmuch --head) I'm a bit at a loss how to investigate this, not using SMIME or macOS myself. Could you try duplicating the problem with the notmuch test key / certificate? I've attached the test key and the ca from from the notmuch source. If you have the same behaviour with this key, then please share a message encrypted to this key that manifests the problem for you (probably as an attachement) [-- Attachment #2: test.crt --] [-- Type: application/x-x509-ca-cert, Size: 1115 bytes --] [-- Attachment #3: ca.crt --] [-- Type: application/x-x509-ca-cert, Size: 1164 bytes --] [-- Attachment #4: Type: text/plain, Size: 4 bytes --] d [-- Attachment #5: Type: text/plain, Size: 0 bytes --]
Alexander Adolf <alexander.adolf@condition-alpha.com> writes:
>
> The actual message content seems to have been decrypted ok (it shows up
> as the text/plain part in the dumped function arguments). Also, I can
> open the message without problems in the Apple Mail.app that ships with
> macOS (shows the same decrypted content, and a good signature).
>
I think I managed to duplicate this problem; it does not seem to be
macOS specific. I'm not yet sure if there are multiple problems, or if the
error message and the need to toggle crypto processing are related.
David Bremner <david@tethera.net> writes:
> Alexander Adolf <alexander.adolf@condition-alpha.com> writes:
>
>>
>> The actual message content seems to have been decrypted ok (it shows up
>> as the text/plain part in the dumped function arguments). Also, I can
>> open the message without problems in the Apple Mail.app that ships with
>> macOS (shows the same decrypted content, and a good signature).
>>
>
> I think I managed to duplicate this problem; it does not seem to be
> macOS specific. I'm not yet sure if there are multiple problems, or if the
> error message and the need to toggle crypto processing are related.
As a workaround, try adding
(defalias 'notmuch-show-insert-part-application/pkcs7-mime
#'notmuch-show-insert-part-multipart/encrypted)
To your notmuch-config.el (or init.el)
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.
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?
Hello David, first of all, many thanks for not giving up on this one! David Bremner <david@tethera.net> writes: > [...] > 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? > [...] Conceptually, a typical s/mime message looks like this: ---------------------------------------------------------------------- Received: From: To: Subject: Date: MIME-Version: 1.0 Content-Disposition: attachment; filename="smime.p7m" Content-Type: application/x-pkcs7-mime; smime-type=enveloped-data; name="smime.p7m" [more headers (opt.)] <empty line> gibberish (the CMS) ---------------------------------------------------------------------- After decrypting the gibberish (CMS), you get a new mime tree structure, in which the top-level entity can be a multipart/signed (most often), or a message/rfc822 (sometimes), or something else (rarely seen) [1]. [1] https://tools.ietf.org/html/rfc8551 I.e. you decrypt, and further mime parts appear. No assumptions should be made about the tree's structure. Quoting from [1]: ---------------------------- Begin Quote ----------------------------- 3.1. Preparing the MIME Entity for Signing, Enveloping, or Compressing S/MIME is used to secure MIME entities. A MIME message is composed of a MIME header and a MIME body. A body can consist of a single MIME entity or a tree of MIME entities (rooted with a multipart). S/MIME can be used to secure either a single MIME entity or a tree of MIME entities. These entities can be in locations other than the root. S/MIME can be applied multiple times to different entities in a single message. [...] ----------------------------- End Quote ------------------------------ After decrypting your "outer" container (the CMS), the result is a mime tree, i.e. should start with "Content-Type:". Standard mime tree processing should be applied (recursively). The bodypart handler error message shows this "embedded (inner) mime tree", and in my case the top-level entity is a multipart/signed. You wrote "the outer container with an encstatus, and one inside that (with the same mime type) with a sigstatus". So it seems that at that point you have access to the root of the "inner tree" (multipart/signed, you can access the sigstatus), but the content-type information is from the "outer" container (the CMS) still. Perhaps the recursive mime re-parsing after the decryption is not happening? More new questions than answers... --alexander
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?
This cures most of the issues for me:
(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))))
(defalias notmuch-show-insert-part-application/x-pkcs7-mime
notmuch-show-insert-part-application/pkcs7-mime)
It shows the contents of the S/MIME message, and could e.g. end up in
notmuch-show.el, I think.
What is left to be desired (IMHO) are some improvements in the gpgsm
integration. User-id and key-id matching is a bit rough sometimes. Not
sure though whether that is a notmuch issue even (probably an EPA one)?
Cheers, and looking forward to your thoughts,
--alexander
Alexander Adolf <alexander.adolf@condition-alpha.com> writes:
> [...]
> (defalias notmuch-show-insert-part-application/x-pkcs7-mime
> notmuch-show-insert-part-application/pkcs7-mime)
> [...]
Err, this should be:
(fset 'notmuch-show-insert-part-application/x-pkcs7-mime
'notmuch-show-insert-part-application/pkcs7-mime)
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