Greetings oh wise ones. I have been using Crypt::OpenPGP for a while now to encrypt plain text and text files but now I want to expand upon that. The following code encrypts a txt file just fine but fails if the file is an exe or a zip file. Is Crypt::OpenPGP capable of doing this or am I barking up the wrong tree? As always any help is appreciated.
$pubringfile = "C:\\pgp\\public.gpg"; $destfile = "C:\\temp\\dest.gpg"; $srcfile = "c:\\temp\\source.zip"; use Crypt::OpenPGP; $pgp = Crypt::OpenPGP->new ( "PubRing" => $pubringfile #### Define path to public ring t +o be used for encryption ); unless($pgp){ my $err = join(" ", "\n\nCOULD NOT ENCRYPT DATA ", Crypt:: +OpenPGP->errstr, "\n\n"); &sndevent("1017", 1, $err); die; } my $ciphertext = $pgp->encrypt ( "Filename" => $srcfile, "Recipients" => 'myemail@hotmail.com', "Cipher" => 'DES3', "Armour" => 0 ); unless($ciphertext){ my $err = join(" ", "\n\nCOULD NOT ENCRYPT DATA ", Crypt:: +OpenPGP->errstr, "\n\n"); print "$err\n"; } open (FILEHANDLE,">$destfile"); print FILEHANDLE "$ciphertext"; close FILEHANDLE;

In reply to Can Crypt::OpenPGP Encrypt exe or zip files by boat73

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.