From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/56268 Path: main.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: [gnu.emacs.gnus] Automatically sign/encrypt messages Date: Tue, 03 Feb 2004 12:15:28 -0500 Organization: =?koi8-r?q?=F4=C5=CF=C4=CF=D2=20=FA=CC=C1=D4=C1=CE=CF=D7?= @ Cienfuegos Sender: ding-owner@lists.math.uh.edu Message-ID: <4nfzdst77z.fsf@collins.bwh.harvard.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="==-=-=" X-Trace: sea.gmane.org 1075828648 31923 80.91.224.253 (3 Feb 2004 17:17:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 3 Feb 2004 17:17:28 +0000 (UTC) Cc: Klaus Uhl Original-X-From: ding-owner+M4808@lists.math.uh.edu Tue Feb 03 18:17:17 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ao4Am-000419-00 for ; Tue, 03 Feb 2004 18:17:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1Ao4Aa-000258-00; Tue, 03 Feb 2004 11:17:04 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1Ao4AV-000253-00 for ding@lists.math.uh.edu; Tue, 03 Feb 2004 11:16:59 -0600 Original-Received: from clifford.bwh.harvard.edu (clifford.bwh.harvard.edu [134.174.9.41]) by justine.libertine.org (Postfix) with ESMTP id 018FA3A0218 for ; Tue, 3 Feb 2004 11:16:59 -0600 (CST) Original-Received: from collins.bwh.harvard.edu (collins [134.174.9.80]) by clifford.bwh.harvard.edu (8.10.2+Sun/8.11.0) with ESMTP id i13HFbU13056; Tue, 3 Feb 2004 12:15:37 -0500 (EST) Original-Received: from collins.bwh.harvard.edu (localhost [127.0.0.1]) by collins.bwh.harvard.edu (8.12.9+Sun/8.11.0) with ESMTP id i13HFTvl021047; Tue, 3 Feb 2004 12:15:29 -0500 (EST) Original-Received: (from tzz@localhost) by collins.bwh.harvard.edu (8.12.9+Sun/8.12.9/Submit) id i13HFS56021044; Tue, 3 Feb 2004 12:15:28 -0500 (EST) Original-To: Ding Mailing List X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Followup-To: Ding Mailing List , Klaus Uhl User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (usg-unix-v) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:56268 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:56268 --==-=-= Is it OK if I make a new function based on the attached message? I'll call it mml-secure-message-encrypt-or-sign-pgpmime Feel free to make alternate suggestions or tell me I'm wrong :) Thanks Ted --==-=-= Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Path: uni-berlin.de!p5088e1af.dip0.t-ipconnect.DE!not-for-mail From: Klaus Uhl Newsgroups: gnu.emacs.gnus Subject: Automatically sign/encrypt messages Date: Thu, 29 Jan 2004 18:31:07 +0100 Lines: 63 Message-ID: <87n086ach0.fsf@ulm.my.lan> NNTP-Posting-Host: p5088e1af.dip0.t-ipconnect.de (80.136.225.175) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: news.uni-berlin.de 1075397455 27492130 80.136.225.175 ([99401]) User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:U2NHjuE1+mrh0fUBnGJRTFummsI= Xref: uni-berlin.de gnu.emacs.gnus:72498 --=-=-= Hi, I am not sure if this of interest for anybody here on this list nor if it was already discussed before. But as I did not find any information via a google search I post this here anyway. First I wanted gnus to automatically sign all sent messages. This was rather easy as a simple (add-hook gnus-message-setup-hook 'mml-secure-message-sign-pgpmime) did the job. But then I wanted to go one step further and not only sign but also encrypt all messages, at least if this is possible (i.e. if the recipient also uses PGP). The first attempt was the following: (add-hook gnus-message-setup-hook 'mml-secure-message-encrypt-pgpmime) But this _always_ tries to encrypt the message, even if the recipient has no PGP key. So I wrote the following hook: (add-hook 'message-send-hook (lambda () (let ((recipient (message-fetch-field "To"))) (cond ((and (not (null recipient)) (or (pgg-lookup-key recipient) (pgg-fetch-key pgg-default-keyserver-address recipient))) (mml-secure-message-encrypt-pgpmime)) (t (mml-secure-message-sign-pgpmime)))))) This works perfectly for me. Gnus encrypts the message if gpg already has the recipient's key in its keyring or if it can get the key from a keyserver. Otherwise the message is only signed. Maybe this helps someone. -- God is real ... \|/ ____ \|/ ... unless declared integer. "@'/ ,. \`@" \_| \__/ |_/ Mail me : news@u-h-l.de \__U_/ WWW : www.u-h-l.de PGP : 0x128F9DEC --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBAGUNfyaizchKPnewRAqm/AJ9XS1Lq3WPILHUHMDU94rI5Ih/kZgCgruMc zp5Tboh+jKLNJHl81wAxjbw= =BLpc -----END PGP SIGNATURE----- --=-=-=-- --==-=-=--