Error on gpg encription using perl cgi

hxzeng hxzeng at
Tue Feb 24 08:33:02 CET 2009

Dear all,

I would like to write a cgi using perl to encrypt some text files in
Windows, the following is my program test.cgi. in the $cmd, Henry is a
public key generated by gpg, and 451080.txt is the files I would like to

print "Content-type: text/html\n\n";
$cmd = "\"C:\\Program Files\\GNU\\GnuPG\\gpg.exe\" -e --no-secmem-warning
--always-trust -a -r Henry C:\\apache\\cgi-bin\\451080.txt";
print $cmd."\n\n";

The question is that if I enter the following command in commander:
"C:\Program Files\GNU\GnuPG\gpg.exe" -e --no-secmem-warning --always-trust
-a -r Henry C:\apache\cgi-bin\451080.txt
The file 451080.txt will successfully be encrypted and new file
451080.txt.asc will be generated.

But when I deployed first.cgi in apache and run it using:
The file cannot be successfully encrypted and also in error.log there has
such errors:

[Tue Feb 24 15:01:40 2009] [error] [client] gpg: Henry: skipped:
public key not found\r
[Tue Feb 24 15:01:40 2009] [error] [client] gpg:
C:\\apache\\cgi-bin\\451080.txt: encryption failed: public key not found\r

Does anybody know how to fix this problem? Why commander can successfully
execute the command but the apache cannot find the public key?

Thanks very much.
View this message in context:
Sent from the GnuPG - User mailing list archive at

More information about the Gnupg-users mailing list