Scripting and CGI use of GPG

phil@Stimpy.netroedge.com phil@Stimpy.netroedge.com
Mon, 30 Aug 1999 17:05:10 -0700 (PDT)


OK, I've been tearing my hair out over a simple implementation of a Perl
CGI which uses GPG.  I've got this test CGI:

--snip!--
#!/usr/bin/perl

print "Content-type: text/html\n\n";

print "<pre>";

print `env`;

$myemail="phil\@stimpy.netroedge.com";

$temp=`echo "blah" | /usr/local/bin/gpg -a -e --yes --batch -r $myemail`;


print $temp;
--snip!--

If I run it on the command line (as the user which the web server runs
under), I get the expected out (i.e., the environment followed by my
encrypted 'blah'). 

If I run it as a CGI through Apache, I only get the environment and not
any encrypted message!  For some reason, GPG doesn't run when it is in a
CGI for me. :'( I've made sure that my key is available for the user which
the web server is running as, and have done everything else I can think
of. 

Somebody posted a Perl implementation a GPG form-mail thing which is close
to what I am doing, but I don't understand why my simple attempt above
doesn't work (or even report an error..).

Ideally, it would be cool if there was a Perl module which allowed Perl
access to GPG routines.  Does this exist?  Using back-ticks to get to the
shell is a drag (and not all that secure). :'p

Thanks in advance for any ideas/help.  In the mean-time, I'll try some
more things.... 


Phil

------------------------------------------------------------
Philip Edelbrock -- IS Manager -- Edge Design, Corvallis, OR
   phil@netroedge.com -- http://www.netroedge.com/~phil
 PGP F16: 01 D2 FD 01 B5 46 F4 F0  3A 8B 9D 7E 14 7F FB 7A