xuo has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
---|