Re: email encryption

Doug Monroe (monroe@lucent.com)
Wed, 03 Feb 1999 08:28:57 -0500


Brian Strand wrote:
> 
> You might try checking out stuff in:
> 
> http://www.cpan.org/modules/00modlist.long.html#14)Authenticati
> 
> as well as Net::SSLeay
> 
> Kevin Naicker wrote:
> >
> > Dear web Master (http://www.linpro.no/lwp/) or appropriate...
> >
> > I was wondering if you guys have scripts for encoding email
> > using CGI... ?
> >
> > I would really appreciate it
> > Kevin Naicker

off-topic for the libwww list but...how about using PGP?
FWIW - bits from a script I had in place once using PGP 2.6.2 -
(untested, more from memory than anything else...)
(newer versions of PGP have diff. cmd line usage)
--
Doug Monroe
Lucent Technologies

#!/usr/local/bin/perl
# setup:
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
$pgppath = "/usr/local/keys"; #keyrings are kept here
$pgpusr = "UserID of a user for whom you have a pubkey";
$pgpusrema = '<user@example.com>';
$encrypt="/usr/local/bin/pgp -fea $pgpusr +verbose=0 2>/dev/null";
# data:
$data="whatever data you want to send, could come from form input";
# encrypt:
$pgpfile="/tmp/pgp.$$";
# First a header, then the ciphertext
open (SPOOL, ">$pgpfile") || die "$Error writing $pgpfile\n";
printf (SPOOL "To: %s\nSubject: Some Subject\n\n", $pgpusrema);
close(SPOOL);
open (SPOOL, "|$encrypt >>$pgpfile") || die "$Error writing $pgpfile\n";
print SPOOL "$data";
close (SPOOL);
# mail:
open(MAIL, "-|") || exec "/usr/lib/sendmail","-t";
open (SPOOL, "$pgpfile") || die "Error reading $pgpfile\n";
@send = <SPOOL>;
close (SPOOL);
print @send;
close (MAIL);
unlink $pgpfile;
exit;