Hello all,

I'm using the Perl module Crypt::GPG and I'm unable to decrypt a file (using the Mageia 8 distribution).

Encryption works well.

So up to now, I was using the system command (system("gpg --decrypt ...) but it seems that now there is a 2mn timeout which makes me unable to use this command on big encrypted files.

As I could not succeed to replace the "system" command with "use IPC::Run qw(run timeout) ; run ...", I'm trying again with the Crypt::GPG module.

Here is my code :

#!/usr/bin/perl use strict ; # Does not exist anymore in Mageia. # use GnuPG qw( :algo ) ; use Crypt::GPG ; my $gpg = new Crypt::GPG ; $gpg->gpgbin('/bin/gpg') ; $gpg->secretkey('my_email_address') ; $gpg->passphrase('my_gpg_passphrase') ; my $encryptedFile = 'myfile.tar.gz.gpg' ; my $tarFile = 'myfile.tar.gz' ; my @encryptedFileArray = () ; open(GPG_FILE, "$encryptedFile") || die "can't open file $encryptedFil +e !" ; @encryptedFileArray = <GPG_FILE> ; close(GPG_FILE) ; my ($plaintext, $signature) = $gpg->verify("\@encryptedFileArray"); # print("$plaintext\n"); open(TAR_FILE, ">$tarFile") || die "can't open file $tarFile !" ; print(TAR_FILE $plaintext) ; close(TAR_FILE) ; exit ;

Do you know what I'm doing wrong ?

Thank you for your wisdom.

Regards.

Xuo.

In reply to Unable to get any decrypted output from $gpg->verify by xuo

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.