Hi all,
I'got an explanation about the IPC error.
After I've rebooted my PC, the script is passing without any issue.
If I run it on a newer/more powerfull/... PC, I can make it pass as well.
Then means that after several trials of my script => several decryption, untar, tar and diff commands, the internal memory (lets call it that way) becomes full and some commands make the script to fail.
About the decryption with "use Crypt::GPG", I still can't make it work. I can create an armour encrypted file as suggested by Tobyink but I can't decrypt it.
Here is the code I'm using :
#!/usr/bin/perl
use strict ;
use Crypt::GPG ;
use Archive::Tar ;
my $gpg = new Crypt::GPG ;
$gpg->gpgbin('/bin/gpg') ;
$gpg->secretkey('my_email_address') ;
$gpg->passphrase('my_gpg_passphrase') ;
$gpg->armor(1) ;
my $encryptedFile = '/home/xuo/TheCat.gpg' ;
my $tarFile_read = '/home/xuo/TheCat.tar.gz' ;
my $tarFile_write = '/home/xuo/TheCat_from_gpg_encrypt.gpg' ;
my @encryptedFileArray = () ;
my @fileToBeEncrypted = () ;
my @fileToBeDecrypted = () ;
my @gpgEncryptedFile = () ;
open(TAR_FILE, "$tarFile_read") || die "can't open file $tarFile_read
+!" ;
@fileToBeEncrypted = <TAR_FILE> ;
close(TAR_FILE) ;
my @gpgEncryptedFile = $gpg->encrypt(\@fileToBeEncrypted, 'my_email_ad
+dress') ;
open(GPG_FILE, ">$encryptedFile") || die "can't open file $encryptedFi
+le !" ;
print GPG_FILE "@gpgEncryptedFile" ;
close(GPG_FILE) ;
open(GPG_FILE, "$encryptedFile") || die "can't open file $encryptedFil
+e !" ;
@fileToBeDecrypted = <GPG_FILE> ;
close(GPG_FILE) ;
my ($plaintext, $signature) = $gpg->verify(\@fileToBeDecrypted) ;
open(TAR_FILE, ">$tarFile_write") || die "can't open file $tarFile_wri
+te !" ;
print TAR_FILE "$plaintext" ;
close(TAR_FILE) ;
exit ;
$ more TheCat.gpg
-----BEGIN PGP MESSAGE-----
Comment: Crypt::GPG v1.64
hQEMA8z8x+FbnSQ6AQf9FXqGTJuwvp4uI51iZSmioyROTK0XkkHUHqnGhJYhJAdN
zQliHEr1ubGHFtcmI7qg4dNpKTZcKD5XWoTNWMEK98CV9t/dzlXVrjlBIT8ztTlQ
5dTJiU0E/SenMpnTTOERL5hm4qIW5+TWWF1zYsuBFIB/4TLX6GrABNTUlNWhsL95
This is a pgp-armored file but the decrypted file is of size 0.
Regards.
Xuo.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.