Encrypt more
When I worked at Demon the guys who developed Turnpike were serious about integration (Turnpike is an offline Multi-user email and news client for Microsoft Windows systems). It was possible to configure the mailer such that if you knew the public key for someone, all mail to that person would be encrypted to their public key. You didn't have to select to encrypt individual messages or to encrypt to particular people, it just happened automatically whenever it was possible.
The intention was to slowly increase the use of encryption between communicating parties. You'd start with little or no keys (perhaps just your own) and would sign all outgoing mail. Over time people would notice that you had signed stuff and would grab your public key and send you their own (of course there was an interface to public key stores as well). Hopefully, over time, more and more people would adopt more of the email exchanged would be (signed and) encrypted and snoop and tamper proof.
Turnpike is a great product, built by people who really care about the user interface, mail standards compliance and customer feedback. Unfortunately, it's not going to take over the world, which means that the approach to "opportunistic encryption" with may not be sufficiently widespread (though see the FreeS/WAN effort for an approach to similar difficulties in encouraging widespread IPsec deployment).
Anyway, as a re-confirmed gnus user, I figured that it should be possible to implement something similar. The result is two small chunks of lisp. The first determines whether or not public keys for all recipients of a message are known:
(defun dme:message-determine-encryption () "Return `t' if we have gpg public keys for all recipients of this message." (catch :exit (mapcar (lambda (addr) (if (not (pgg-lookup-key (downcase (mail-strip-quoted-names addr)))) (throw :exit nil))) (message-tokenize-header (concat (message-fetch-field "to") "," (message-fetch-field "cc")))) t))
The second, which is present in my message-send-hook, uses this information to insert the mml tags required to indicate that the message should be encrypted:
... (message-goto-body) ; if already set, don't override (if (not (looking-at (regexp-quote "<#secure "))) ; if we can encrypt, do so, else just sign (if (dme:message-determine-encryption) (insert "<#secure method=pgpmime mode=signencrypt>\n") (insert "<#secure method=pgpmime mode=sign>\n"))) )) ...
Note that when encryption is not possible, the email is still signed.
The main problem with this code is that it's necessary to possess the public keys for all recipients of a message before encryption will be used. If there are three recipients yet only two have known public keys, the message will not be encrypted. It should be possible to encrypt the message when sent to the two and use cleartext (actually signed) for the third. That requires rather more fiddling with the mail submission component of gnus than I've so far managed to figure out.
It seems that the Enigmail plugin for Mozilla does something similar, though perhaps by attempting to encrypt, failing and then sending as cleartext.
Are there any other mailers which attempt opportunistic encryption?