Gnus development mailing list
 help / color / mirror / Atom feed
* [gnu.emacs.gnus] Automatically sign/encrypt messages
@ 2004-02-03 17:15 Ted Zlatanov
  2004-02-04  6:36 ` Xavier Maillard
  2004-02-04  6:37 ` Ivan Boldyrev
  0 siblings, 2 replies; 4+ messages in thread
From: Ted Zlatanov @ 2004-02-03 17:15 UTC (permalink / raw)
  Cc: Klaus Uhl

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

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


[-- Attachment #2: Type: message/rfc822, Size: 2448 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 1522 bytes --]

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

[-- Attachment #2.1.2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gnu.emacs.gnus] Automatically sign/encrypt messages
  2004-02-03 17:15 [gnu.emacs.gnus] Automatically sign/encrypt messages Ted Zlatanov
@ 2004-02-04  6:36 ` Xavier Maillard
  2004-02-04  6:37 ` Ivan Boldyrev
  1 sibling, 0 replies; 4+ messages in thread
From: Xavier Maillard @ 2004-02-04  6:36 UTC (permalink / raw)
  Cc: Klaus Uhl

[-- Attachment #1: Type: text/plain, Size: 345 bytes --]

On 3 Feb 2004, Ted Zlatanov verbalised:

> Is it OK if I make a new function based on the attached message?

Yup it is one of the missing feature compared to other MUA such as
Thunderbird which already implements that. 

 <snip>

zeDek
-- 
GnusFR  (http://www.gnusfr.org)
EmacsFR (http://www.emacsfr.org)

.emacs: Because customisation is fun!


[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gnu.emacs.gnus] Automatically sign/encrypt messages
  2004-02-03 17:15 [gnu.emacs.gnus] Automatically sign/encrypt messages Ted Zlatanov
  2004-02-04  6:36 ` Xavier Maillard
@ 2004-02-04  6:37 ` Ivan Boldyrev
  2004-02-05 20:01   ` Ted Zlatanov
  1 sibling, 1 reply; 4+ messages in thread
From: Ivan Boldyrev @ 2004-02-04  6:37 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 724 bytes --]

On 8643 day of my life Ted Zlatanov wrote:
> 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 :)

If there is a recipient with key in To and number of recipients
without a keys in Bcc or Cc, the hook will not let send a message
(because it will attempt to encrypt, but fail).

It also useful to check if there is only one recipient in To (and
maybe, try to check every recipient's key; then it worth to process
Cc/Bcc as well).

It's also would be nice to check recipients with regexps...


-- 
Ivan Boldyrev

                        Today is the first day of the rest of your life.

[-- Attachment #2: Type: application/pgp-signature, Size: 480 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gnu.emacs.gnus] Automatically sign/encrypt messages
  2004-02-04  6:37 ` Ivan Boldyrev
@ 2004-02-05 20:01   ` Ted Zlatanov
  0 siblings, 0 replies; 4+ messages in thread
From: Ted Zlatanov @ 2004-02-05 20:01 UTC (permalink / raw)
  Cc: Klaus Uhl

On Wed, 04 Feb 2004, boldyrev+nospam@cgitftp.uiggm.nsc.ru wrote:

> If there is a recipient with key in To and number of recipients
> without a keys in Bcc or Cc, the hook will not let send a message
> (because it will attempt to encrypt, but fail).
> 
> It also useful to check if there is only one recipient in To (and
> maybe, try to check every recipient's key; then it worth to process
> Cc/Bcc as well).
> 
> It's also would be nice to check recipients with regexps...

Klaus Uhl, the original writer, and Eric Simon on gnu.emacs.gnus have
been improving the code, so I'll wait for a definitive version of the
patch before I commit it.  I think what you mention above was
discussed and Eric came up with a version that works properly.

I like the feature a lot, by the way.  It's nice to have Gnus do the
right thing :)

Ted



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-05 20:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-03 17:15 [gnu.emacs.gnus] Automatically sign/encrypt messages Ted Zlatanov
2004-02-04  6:36 ` Xavier Maillard
2004-02-04  6:37 ` Ivan Boldyrev
2004-02-05 20:01   ` Ted Zlatanov

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).