Subject: | GPG->decrypt() returns undef because of STDERR not empty, decrypted text expected. |
Hello,
GPG->decrypt() in GPG-v0.06 doesn't return decrypted text as expected
with GnuPG v1.4.11.
The problem lies in:
~~~SNIP~~~
gpg: encrypted with 2048-bit ELG-E key, ID KEYID, created DATE
"Some Guy (my_key) <foo@bar.tld>"
gpg: encrypted with 2048-bit RSA key, ID KEYID, created DATE
"Some OtherGuy <bar@foo.tld>"
~~~SNIP~~~
at STDERR.
Now, from GPG.pm:
~~~ SNIP ~~~
sub decrypt { my ($this,$passphrase,$text) = @_;
my ($pid,$output,$error) = start_gpg($this,$this->{'COMMAND'}.
"--passphrase-fd 0 --decrypt", "$passphrase\n$text");
return if !$pid;
# the problem is bellow
$this->error($error) and return if $error;
return $output;
}
~~~ SNIP ~~~
nothing gets returned, because STDERR is not empty.
Suggested fix is ... well, I'm not familiar with # gpg;, so it's really
hard to say what the suggested fix should look like.
1] return code of # gpg; If it's not zero(0), something went wrong.
2] match STDERR for:
~~~ SNIP ~~~
gpg: public key decryption failed: bad passphrase
gpg: decryption failed: secret key not available
~~~ SNIP ~~~
and if this is matched, then yeah, there is an error. However, these
might change depending on what went wrong, right?
I hope your reply is going to be: "You must be doing something
completely wrong.", but I've tried to hack around this linke and if I
comment it out, GPG->decrypt() does what's expected - returns decrypted
text.
Thanks,
Zdenek
PS: I found debug mode to be very useful.
Subject: | perl-ver.txt |
Summary of my perl5 (revision 5 version 14 subversion 0) configuration:
Platform:
osname=linux, osvers=2.6.37.6, archname=x86_64-linux-thread-multi
uname='linux midas64 2.6.37.6 #2 smp sat apr 9 13:24:51 cdt 2011 x86_64 amd athlon(tm) ii x2 235e processor authenticamd gnulinux '
config_args='-de -Dprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Darchlib=/usr/lib64/perl5 -Dvendorprefix=/usr -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Dvendorarch=/usr/lib64/perl5/vendor_perl -Dscriptdir=/usr/bin -Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dlibpth=/usr/local/lib64 /usr/lib64 /lib64 -Doptimize=-O2 -fPIC -Dusethreads -Duseithreads -Duseshrplib -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Darchname=x86_64-linux'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -fPIC',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.5.2', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector'
libpth=/usr/local/lib64 /usr/lib64 /lib64
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib64/libc-2.13.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.13'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -fPIC -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Built under linux
Compiled at May 14 2011 21:49:45
@INC:
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
.
Subject: | gpg-ver.txt |
gpg (GnuPG) 1.4.11
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
Cipher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128,
CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2