From: Uwe Brauer <oub@mat.ucm.es>
To: ding@gnus.org
Subject: Re: Maybe encrypt message ?
Date: Tue, 24 Nov 2015 12:18:41 +0000 [thread overview]
Message-ID: <878u5nfv4u.fsf@mat.ucm.es> (raw)
In-Reply-To: <m0twocx6zx.fsf@kcals.intra.maillard.im>
>>> "Xavier" == Xavier Maillard <lists.emacs.gnus@xavier.maillard.im> writes:
> Hello,
> what is the correct way to tell gnus/message to 'maybe' encrypt an outgoing
> message ?
> I previously set it via `message-setup-hook' by adding
> `mml-secure-message-encrypt'. For a reason I do not understand, it encrypted
> *ALL* outgoing messages (even on mailing-lists). That's lame since for some, I
> remember having been asked to ignore encryption for recipient I did not have a
> public key...
> How do you practice PGP encryption/signing in Gnus ?
There are three possiblities.
- if you reply to an email, you can sign/encrypt depending of
whether the send did this also.
(add-hook 'gnus-message-setup-hook 'my-check-reply-encrypted)
;; that function is courtesy of Dave Goldberg
(defun my-check-reply-encrypted ()
(interactive)
(cond ((and gnus-article-reply
(message-with-reply-buffer
(re-search-forward
"^Content-Type.*application/\\(x-\\)?pkcs7-mime\\|protocol=\"application/pkcs7-signature\""
; "^Content-Type.*application/\\(x-\\)?pkcs7-mime"
nil t)))
(condition-case nil
(mml-secure-message-encrypt-smime nil)
(error
(message "One or more recipients do not have certs"))))))
- You can use have an entry in your bbdb.
For example
encrypt: smime
or
encrypt: gpg
than gnus encrypt using smime or gpg
Or nothing gnus does not do anything.
- However if I also want to sign my message than this approach is
too restrictive. So I have a yes-o-no function in my
message-send-hook namely my-hook-encrypt-or-sign-smime
(defun my-hook-encrypt-or-sign-smime ()
(interactive)
(call-interactively 'my-select-encrypt-or-sign-smime))
(defun my-leave-the-TAG ()
(interactive)
(message "Left the TAG intact, since it is a pgp/(mime) message."))
(defun my-select-encrypt-or-sign-smime (ch)
(interactive "c1: encrypt, 2: encryt+sign, 3: sign 4: NO TAG 5: leave it: pgp/mime")
(setq ch (downcase ch))
(call-interactively (cond ((eql ch ?1) #'my-only-encrypt-smime)
((eql ch ?2) #'my-encrypt-and-sign-smime)
((eql ch ?3) #'mml-secure-message-sign-smime)
((eql ch ?4) #'my-mml-eliminate-smime-pgp-tag)
((eql ch ?5) #'my-leave-the-TAG)
(t (error 'args-out-of-range '(1 2 3 4 5 ch))))))
You could do something similar for gpg instead of smime.
Uwe Brauer
next prev parent reply other threads:[~2015-11-24 12:18 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 [this message]
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
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=878u5nfv4u.fsf@mat.ucm.es \
--to=oub@mat.ucm.es \
--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).