[linux-l] perl script mit GnuPG::Interface - Hilfe

wegwerf4 at gmx.de wegwerf4 at gmx.de
Mo Aug 22 15:37:28 CEST 2011


ach, so, das Skript lautet:

#!/usr/bin/perl -w
use IO::Handle;
use IO::File;
use GnuPG::Interface;
 
my $gnupg = GnuPG::Interface->new();
$gnupg->options->hash_init( recipients => [ 'email at provider.de','XXXXXXXX' ] );
$gnupg->options->hash_init( armor   => 1,homedir => '/daten/gpg' );
$gnupg->options->meta_interactive( 0 );

         my ( $input, $output, $error, $status_fh )
           = ( IO::Handle->new(),
               IO::Handle->new(),
               IO::Handle->new(),
               IO::Handle->new(),
             );

         my $handles = GnuPG::Handles->new( stdin      => $input,
                                            stdout     => $output,
                                            stderr     => $error,
                                            status     => $status_fh,
                                          );

         my $cipher_file = IO::File->new( '/daten/gpg/config.txt.gpg' );

[ hier folgt eine Schleife, die Zeichen erzeugt und nach $passphrase schreibt]


$passphrase = "XXXXXXXX";
print $passphrase,"\n";

         $gnupg->passphrase( $passphrase );
         my $pid = $gnupg->decrypt( handles => $handles );

         print $input $_ while <$cipher_file>;
         waitpid $pid, 0;  # clean up the finished GnuPG process

close $input;
close $cipher_file;

my @plaintext    = <$output>;   # reading the output
my @error_output = <$error>;    # reading the error
my @status_info  = <$status_fh>;# read the status info

         # clean up...
close $output;
close $error;
close $status_fh;




Mehr Informationen über die Mailingliste linux-l