in reply to works as a perl script, but not as cgi

On my system, the www-data user does not have write permission to its own home directory (/var/www). For --gen-random (but not for --enarmor), GnuPG wants to create a ~/.gnupg directory and fails, which it considers fatal. This works:

gpg --homedir /tmp --gen-random 1 16

...although it creates two files in /tmp and emits messages to that effect. Note also that it does not work if the two options are reversed—the --homedir option has to be first.

I don't know if that's your problem or not, but it's worth checking. (As already suggested, check your error log.)

Replies are listed 'Best First'.
Re^2: works as a perl script, but not as cgi
by gstrock (Initiate) on Dec 21, 2006 at 21:38 UTC
    thanks everybody. Yup. I should have checked the log files.
    ~/.gnupg: can't create directory: No such file or directory
    I was focusing on it as strictly a perl problem, when I should have read the gpg man page instead.

    my bad.