Gnus development mailing list
 help / color / mirror / Atom feed
From: "Peter Münster" <pmlists@free.fr>
To: ding@gnus.org
Subject: Re: Maybe encrypt message ?
Date: Tue, 24 Nov 2015 22:17:27 +0100	[thread overview]
Message-ID: <87h9kb9jx4.fsf@roche-blanche.net> (raw)
In-Reply-To: <m0twocx6zx.fsf@kcals.intra.maillard.im>

On Tue, Nov 24 2015, Xavier Maillard wrote:

> How do you practice PGP encryption/signing in Gnus ?

I use jl-encrypt and "roles". When my role is not "list", I sign the
message and when public keys for all recipients are available I also
encrypt it. Here some lines of my setup:

--8<---------------cut here---------------start------------->8---
(require 'jl-encrypt)

(defun pm/message-send ()
  (unless (message-field-value gnus-delay-header)
    (unless (string-equal pm/role "list")
      (if (jl-epg-check-unique-keys (jl-mail-recipients))
          (mml-secure-message-sign-encrypt)
        (mml-secure-message-sign)))
    (pm/spell)))

(defun pm/gnus-article-receive-epg-keys ()
  "Fetch unknown keys from a signed message.
From http://article.gmane.org/gmane.emacs.gnus.user/15894"
  (interactive)
  (goto-char (point-min))
  (if (re-search-forward
       "\\[\\[PGP Signed Part:No public key for \\([A-F0-9]\\{16,16\\}\\) created at "
       nil 'noerror)
      (progn
        (epg-import-keys-from-server (epg-make-context 'OpenPGP)
                                     (list (match-string 1)))
        (gnus-summary-prev-article)
        (gnus-summary-next-article)
        (gnus-summary-select-article-buffer))
    (message "No unknown signed parts found.")))

(defun pm/update-role ()
  "Check current buffer and update pm/role accordingly."
  (let* ((address (mail-strip-quoted-names
                   (message-fetch-field "From")))
         (role (pm/addr->role address)))
    (when role (setq pm/role role))))

(setq
 mm-decrypt-option                 'always
 mm-verify-option                  'always
 mml2015-encrypt-to-self           t
 mml2015-sign-with-sender          t)

(add-hook 'gnus-message-setup-hook      'pm/message-setup)
(add-hook 'message-send-hook            'pm/message-send)
--8<---------------cut here---------------end--------------->8---

-- 
           Peter




  parent reply	other threads:[~2015-11-24 21:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24  6:10 Xavier Maillard
2015-11-24 12:18 ` Uwe Brauer
2015-11-24 20:53   ` Xavier Maillard
2015-11-25 11:03     ` Uwe Brauer
2015-11-24 16:22 ` Jens Lechtenboerger
2015-11-24 20:48   ` Xavier Maillard
2015-11-24 21:17 ` Peter Münster [this message]
2015-11-25 11:04   ` Uwe Brauer
2015-11-26  5:00   ` Xavier Maillard
2015-11-26 10:11     ` Peter Münster
2015-11-26 14:44       ` Xavier Maillard

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=87h9kb9jx4.fsf@roche-blanche.net \
    --to=pmlists@free.fr \
    --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).