Oop, just noticed that the cut and paste didn't get everything...

Here's the rest...

# {{{ encrypt my $encrypted_file = IO::File->new( ">$gpgmpw" ) || die "\n\nUnable to open encrypted master.passwd file. $!\ +n"; my $mpw_file = IO::File->new( "<$mpw" ) || die "\n\nUnable to open master.passwd file. $!\n"; my $gnupg = GnuPG::Interface->new(); $gnupg->options->hash_init( armor => 1, homedir => '/root/.g +nupg' ); $gnupg->options->push_recipients( 'root@propane.gwi' ); $gnupg->options->meta_interactive( 0 ); #my @original_plaintext = <$mpw_file>; ##my $passphrase = "Three Little Pigs"; # We'll let the standard error of GnuPG pass through # to our own standard error, by not creating # a stderr-part of the $handles object. my ( $input, $output, $error, $status_fh ) = ( IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new() ); my $handles = GnuPG::Handles->new( stdin => $mpw_file, stdout => $output, stderr => $error, status => $status_fh ); # This is necessary for reading stdin handle from an open file $handles->options( 'stdin' )->{direct} = 1; # this sets up the communication # Note that the recipients were specified earlier # in the 'options' data member of the $gnupg object. my $pid = $gnupg->encrypt( handles => $handles ); # this closes the communication channel, # indicating we are done my @ciphertext = <$output>; # reading the output my @status_info = <$status_fh>; # reading the status info my @error_output = <$error>; # reading the error print $encrypted_file @ciphertext; print @status_info if $opt_v; # only if verbose print @error_output if $opt_v; # only if verbose close $mpw_file; close $output; close $status_fh; close $error; close $encrypted_file; waitpid $pid, 0; # clean up the finished GnuPG process # }}} } } # }}}

~~
naChoZ


In reply to Re: GnuPG::Interface by naChoZ
in thread GnuPG::Interface by naChoZ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.