Gnus development mailing list
 help / color / mirror / Atom feed
From: Christoph Groth <christoph@grothesque.org>
To: ding@gnus.org
Subject: [PATCH] Re: SMIME: intermediate certificates are not sent
Date: Mon, 22 Sep 2014 14:58:42 +0200	[thread overview]
Message-ID: <87oau7q0al.fsf@grothesque.org> (raw)
In-Reply-To: <87vbof6f2o.fsf@grothesque.org>

Just in case someone is motivated to fix the S/MIME with openssl bug
(which is still the default S/MIME method in Gnus):
I've found the following workaround:
http://www.normalesup.org/~martinez/emacs/#sign_additional_certificates

The following code is equivalent, only cleaned up a bit and merged with
the current Gnus codebase.  Adding it to ~/.gnus solves the issue, but
perhaps the function changes could be commited to Gnus?

--8<---------------cut here---------------start------------->8---
;; Patch to smime-sign-buffer and mml-smime-openssl-sign-query to put
;; the email address in the keyfile argument of <#secure> tag instead
;; of the key filename to take additional certificates into account when
;; signing a message.

(require 'smime) ; smime-sign-buffer comes from here

(defun smime-sign-buffer (&optional keyfile buffer)
  "S/MIME sign BUFFER with key in KEYFILE.
KEYFILE should contain a PEM encoded key and certificate."
  (interactive)
  (with-current-buffer (or buffer (current-buffer))
    (unless (smime-sign-region
             (point-min) (point-max)
             (if keyfile
                 (smime-get-key-with-certs-by-email keyfile)
               (smime-get-key-with-certs-by-email
                (gnus-completing-read
                 "Sign using key"
                 smime-keys nil (car-safe (car-safe smime-keys))))))
      (error "Signing failed"))))


(require 'mml-smime) ; mml-smime-openssl-sign-query comes from here

(defun mml-smime-openssl-sign-query ()
  ;; query information (what certificate) from user when MML tag is
  ;; added, for use later by the signing process
  (when (null smime-keys)
    (customize-variable 'smime-keys)
    (error "No S/MIME keys configured, use customize to add your key"))
  (list 'keyfile
        (if (= (length smime-keys) 1)
            (caar smime-keys)
          (or (cadr (funcall (if (boundp
                                  'gnus-extract-address-components)
                                 gnus-extract-address-components
                               'mail-extract-address-components)
                             (or (save-excursion
                                   (save-restriction
                                     (message-narrow-to-headers)
                                     (message-fetch-field "from")))
                                 "")))
              (gnus-completing-read "Sign this part with what signature"
                                    (mapcar 'car smime-keys) nil nil nil
                                    (and (listp (car-safe smime-keys))
                                         (caar smime-keys)))))))
--8<---------------cut here---------------end--------------->8---




  parent reply	other threads:[~2014-09-22 12:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-22 11:59 Christoph Groth
2014-09-22 12:13 ` Uwe Brauer
2014-09-22 12:50   ` Christoph Groth
2014-09-22 12:58 ` Christoph Groth [this message]
2015-01-27  3:11   ` [PATCH] " Lars Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=87oau7q0al.fsf@grothesque.org \
    --to=christoph@grothesque.org \
    --cc=ding@gnus.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.
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 NNTP newsgroup(s).