[Mimedefang] PGP encyption of outging email

Steffen Kaiser skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Thu May 7 03:42:31 EDT 2009

Hash: SHA1

On Wed, 6 May 2009, pete wrote:

> Is there a method for encrypting outgoing email using PGP (or other
> methods). I am thinking of doing this on a per recipient basis. I.e encrypt
> email to people I regularly email and leave plain the rest.

If you search CPAN, you find tons of PGP / GnuPG modules unfortunatly. I 
made a quick search for PGP & MIME (so you don't fiddle with the MIME 
structure yourself) and there are a few as well, e.g. Mail::GnuPG.

The most problem I see is that you have to open your secret key to 
MIMEDefang. As I understand your mail so, that you are using a 
single-person system, this drops down to how secure your server is and if 
you trust the system to hold your key without passphrase or in pgp-agent.

If the mail has more than one recipient, you need to use 
"stream_by_recipient()" (or similiar) to have all recipients receiving 
either encrypted or not.

Depending on the module you need to encrypt either in filter() each part 
or in filter_end() the message awhole.

BTW: You wrote "encrypt", if you really mean "encrypt" rather than "sign", 
you need to have the public keys of the recipients, maybe from a 
keyserver, and if there are multiple recipients, you need to think about 
if you encrypt for all recipients (and yourself) and send one copy of the 
mail to all or send one mail per recipient (using stream_by_recipient()).

Long time ago I looked at to sign the first text part of each outgoing 
message using PGP, but we dropped the idea after initial stage because of 
the security problems of the private keys.

I wonder why you don't want to encrypt/sign in the MUA. It is more 
flexible and, well, works most of the time.


- -- 
Steffen Kaiser
Version: GnuPG v1.4.6 (GNU/Linux)


More information about the MIMEDefang mailing list