logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

GnuPG::Tie::Encrypt - Tied filehandle interface to encryption with the GNU Privacy Guard.

Author

       Francis J. Lacoste <francis.lacoste@Contre.COM>

Description

       GnuPG::Tie::Encrypt and GnuPG::Tie::Decrypt provides a tied  file handle interface to
       encryption/decryption facilities of the GNU Privacy guard.

       With GnuPG::Tie::Encrypt everything you write to the file handle will be encrypted. You can read the
       ciphertext from the same file handle.

       With GnuPG::Tie::Decrypt you may read the plaintext equivalent of a ciphertext. This is one can have been
       written to file handle.

       All options given to the tie constructor will be passed on to the underlying GnuPG object. You can use a
       mix of options to output directly to a file or to read directly from a file, only remember than once you
       start reading from the file handle you can't write to it anymore.

Name

       GnuPG::Tie::Encrypt - Tied filehandle interface to encryption with the GNU Privacy Guard.

       GnuPG::Tie::Decrypt - Tied filehandle interface to decryption with the GNU Privacy Guard.

See Also

gpg(1) GnuPG(3)

perl v5.36.0                                       2022-10-13                                    GnuPG::Tie(3pm)

Synopsis

           use GnuPG::Tie::Encrypt;
           use GnuPG::Tie::Decrypt;

           tie *CIPHER, 'GnuPG::Tie::Encrypt', armor => 1, recipient => 'User';
           print CIPHER <<EOF;
       This is a secret
       EOF
           local $/ = undef;
           my $ciphertext = <CIPHER>;
           close CIPHER;
           untie *CIPHER;

           tie *PLAINTEXT, 'GnuPG::Tie::Decrypt', passphrase => 'secret';
           print PLAINTEXT $ciphertext;
           my $plaintext = <PLAINTEXT>;

           # $plaintext should now contains 'This is a secret'
           close PLAINTEXT;
           untie *PLAINTEXT;

See Also