Decryption using GnuPG:Interface and Perl

Frank Tobin ftobin@uiuc.edu
Tue Jun 19 20:51:01 2001


christopher.a.feathers@accenture.com, at 11:24 on Tue, 19 Jun 2001, wrote:


    Can't seem to get #2 to work - do you have an example?

It would go something like this:

my ( $stdin, $pass, $status )
  = ( IO::Handle->new(), IO::Handle->new(), IO::Handle->new() )


my $handles = GnuPG::Handles->new( stdin => $stdin,
                                   status => $status
                                   passphrase => $pass );


$gnupg->decrypt( handles => $handles );

$passphrase->print( "three little pigs" );
$passphrase->close();

while ( <$status> )
{
  if ( /BAD_PASSPHRASE/ or /MISSING_PASSPHRASE/ )
  {
    die "Whoops!";
  }

  last /GOOD_PASSPHRASE/; # yay!
}

$stdin->print( $encrypted_stuff )

-- 
Frank Tobin		http://www.uiuc.edu/~ftobin/