From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/86333 Path: news.gmane.org!not-for-mail From: Uwe Brauer Newsgroups: gmane.emacs.gnus.general Subject: Re: Maybe encrypt message ? Date: Tue, 24 Nov 2015 12:18:41 +0000 Message-ID: <878u5nfv4u.fsf@mat.ucm.es> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1448367591 21439 80.91.229.3 (24 Nov 2015 12:19:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Nov 2015 12:19:51 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M34565@lists.math.uh.edu Tue Nov 24 13:19:38 2015 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from lists1.math.uh.edu ([129.7.128.208]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a1CZN-0007cN-3L for ding-account@gmane.org; Tue, 24 Nov 2015 13:19:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.85) (envelope-from ) id 1a1CYn-0007OP-Co; Tue, 24 Nov 2015 06:19:01 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1a1CYl-0007O3-Ee for ding@lists.math.uh.edu; Tue, 24 Nov 2015 06:18:59 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.85) (envelope-from ) id 1a1CYi-0004VV-KC for ding@lists.math.uh.edu; Tue, 24 Nov 2015 06:18:59 -0600 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1a1CYg-0006bj-LY for ding@gnus.org; Tue, 24 Nov 2015 13:18:54 +0100 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a1CYc-0006M9-V3 for ding@gnus.org; Tue, 24 Nov 2015 13:18:51 +0100 Original-Received: from gilgamesch.quim.ucm.es ([147.96.12.99]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 24 Nov 2015 13:18:50 +0100 Original-Received: from oub by gilgamesch.quim.ucm.es with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 24 Nov 2015 13:18:50 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-Lines: 74 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: gilgamesch.quim.ucm.es Mail-Copies-To: never User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:Se7KXS+BPbO01cc/kOCJbH3+bgA= X-Spam-Score: -3.5 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:86333 Archived-At: >>> "Xavier" == Xavier Maillard 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