Hi,
I am not able to generate gpg signed message using php. I am issuing following command to generate message
$respons=exec("/usr/bin/gpg --homedir ~/.gnupg --yes --batch -u PLANETHIPPO --passphrase-file pf.txt --status-fd 1 --clearsign --force-v3-sigs /home/planet/public_html/msg2.txt", $res);
In my appache error log I am getting error message
gpg: /home/planet/public_html/msg2.asc: clearsign failed: secret key not available
Please help me.
Thanks & Regards,
Vishal
How to generate gpg signed message using PHP
Moderator: General Moderators
-
Vishal Bhurangi
- Forum Newbie
- Posts: 2
- Joined: Wed Apr 18, 2007 11:09 am
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
This is a long shot, but I think your pass phrase file is not being found. Are you sure pf.txt exists and you are pointing to it correctly?
Last edited by John Cartwright on Wed Apr 18, 2007 11:50 am, edited 1 time in total.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
Vishal Bhurangi
- Forum Newbie
- Posts: 2
- Joined: Wed Apr 18, 2007 11:09 am
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Vishal Bhurangi wrote:Hi
Thanks for your reply.
Same command is working without any error or warning from Linux shell prompt.
Regards,
Vishal
From the same directory the script is in?
EDIT | Make sure the web user (www-data, apache, or nobody or some other user) has access to read the relevant files.
I think this "--homedir ~/.gnupg " is the key to your problem. In php you are probably not running as same user as from cli, hence leading to different directories.$respons=exec("/usr/bin/gpg --homedir ~/.gnupg --yes --batch -u PLANETHIPPO --passphrase-file pf.txt --status-fd 1 --clearsign --force-v3-sigs /home/planet/public_html/msg2.txt", $res);