GnuPG::Interface

Michael Curtis mcctsu@kda.attmil.ne.jp
Mon, 28 Aug 2000 10:37:06 +0900


I was using GnuPG through a CGI script using GnuPG::Interface, but after
replacing my test recipient key with actual recipient keys, I don't get any
output from the CGI. The keys work from a telnet command line ex.
"gpg --homedir /home/tsupac/keys -aer library@www.tsupacific.com", so the
new keys seem to be ok. My script, which is basically cut and pasted from
the GnuPG::Interface documentation is below. It worked before, now it
doesn't. I've tried tweeking it with little changes about 100 times with no
success. If anyone can think of why it doesn't work, I would appreciate your
help.

Mike

--- START OF SCRIPT ---

#!/usr/bin/perl

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

# A simple example
use IO::Handle;
use GnuPG::Interface;

# setting up the situation
my $gnupg = GnuPG::Interface->new();
$gnupg->options->hash_init( armor   => 1,
                            homedir => '/home/tsupac/keys' );

# Note you can set the recipients even if you aren't encrypting!
$gnupg->options->push_recipients( 'library@www.tsupacific.com' );
$gnupg->options->meta_interactive( 0 );

# how we create some handles to interact with GnuPG
my $input   = IO::Handle->new();
my $output  = IO::Handle->new();
my $handles = GnuPG::Handles->new( stdin  => $input,
                                   stdout => $output );

# Now we'll go about encrypting with the options already set
my @plaintext = ( "foobar" );
$gnupg->encrypt( handles => $handles );

# Now we write to the input of GnuPG
print $input @plaintext;
close $input;

# now we read the output
my @ciphertext = <$output>;
close $output;

wait;

$mailprog = '/usr/lib/sendmail';
open(MAIL,"|$mailprog -t");
print MAIL "To: \"Michael Curtis\" <mcctsu\@kda.attmil.ne.jp>\n";
 foreach $line (@ciphertext){
 print MAIL "$line";
 }
close (MAIL);

print "<pre>Your message has been encrypted and sent.</pre>\n";
print "<pre>\n";
 foreach $line (@ciphertext){
 print "$line";
 }
print "</pre>\n";

exit;

--- END OF SCRIPT ---

-- 
Archive is at http://lists.gnupg.org - Unsubscribe by sending mail
with a subject of  "unsubscribe"  to gnupg-users-request@gnupg.org