Using GPG to encrypt web form data (was: newbie question)
Anthony E . Greene
agreene@pobox.com
Tue Jun 19 03:11:01 2001
On Mon, 18 Jun 2001 13:50:39 John Hoskins wrote:
>Looking for simplest method to encrypt the post of a www form and email
>content to a single user running a Windows OS.
#!/usr/bin/perl
#
use CGI;
$form =3D new CGI;
$fname =3D $form->param("FirstName");
$lname =3D $form->param("LastName");
$emailaddr =3D $form->param("EmailAddress");
$mailprog =3D "| gpg --homedir /home/httpd/gnupg -ea --always-trust \
| mail -s 'Form Data' $recipient";
open(MAIL,$mailprog);
print MAIL "Name: $fname $lname\n";
print MAIL "Email: $emailaddr\n";
close(MAIL);
There's no error checking but it should work. It assumes you put a public
keyring in /home/httpd/gnupg for use by the httpd user (nobody). You keep
the associated secret key on your Windows box or on a floppy to be used with
your Windows box. Your options file should include default-recipient and
encrypt-to so that you do not have to specify a recipient on the gpg command
line.
Note the new subject on this message. Hopefully it will make someone's
archive search easier. You're actually a little lucky, because I routinely
delete messages with undescriptive subjects without reading them.
Tony
--=20
Anthony E. Greene <agreene@pobox.com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26 C484 A42A 60DD 6C94 239D
Chat: AOL/Yahoo: TonyG05 MSN: te_greene
Linux. The choice of a GNU Generation. <http://www.linux.org/>