Re: Crypt::GPG won't decrypt file...rewrote it to use system, but only partially works



RICHARD FERNANDEZ wrote:
I re-wrote the decryption routine to use system instead of Crypt::GPG,
and came across another puzzle:

my @gpg_command = ("/usr/bin/gpg --decrypt $encrypted >
$decrypted 2> /dev/null");
system(@gpg_command) == 0 or warn "system @gpg_command failed:
$!";

works. It decrypts my file successfully. But if I break up the arguments
like it says in the doco, like so:

my @gpg_command = ("/usr/bin/gpg", "--decrypt", $encrypted, ">",
$decrypted, "2> /dev/null");
system(@gpg_command) == 0 or warn "system @gpg_command failed:
$!";

it does not work. Instead I get a "usage" error.


Could someone please explain where I've gone wrong? I would like to use
Crypt::GPG instead of system, but I have to get this finished.
Thanks!

richf


In my various attempts to get the gnupg related modules working on CPAN
I came up with two options Crypt::OpenPGP which is in general slow
because it attempts to do things in Perl, and GnuPG::Interface which
worked almost perfectly but we were using it in a weird fork model kind
of way, for doing a single encrypt/decrypt run at a time it worked
brilliantly. Having said that, one caveat, my analysis was done in early
2003.

I would suggest giving GnuPG::Interface a go because it handled calling
out to 'gpg' most "correctly". Meaning it uses the status-fd, logger-fd
options properly which is the preferred way to call gpg in an automated
fashion.

Good luck,

http://danconia.org
.