newbie question "Public key not found" with PHP
Derek Vokey
turfdog@planetturf.ca
Tue, 12 Dec 2000 17:58:01 -0800
How did you set it up - running under your username or under the PHP user
"nobody"? If you access it with php it wants "nobody's" keyring. I set it
all up through scripts like so: (easy as all heck)
<?
echo exec("/usr/bin/gpg -vv --homedir /path/to/mydir/.gnupg --gen-key
2>&1",$e)."<br>";
echo "<b>response to --gen-key:</b><br>";
while( $res=each($e) )
{
echo "$res[1]<BR>";
}
?>
then run
<?
echo exec("/usr/bin/gpg -vv --homedir /path/to/mydir/.gnupg --import
/path/to/mydir/.gnupg/mykey.asc 2>&1",$e)."<br>";
echo "<br><b>response to import:</b><br>";
while( $res=each($e) )
{
echo "$res[1]<BR>";
}
?>
I also tried setting the environment variable as well and that works too.
I hope you find some of this useful,
Derek
To the group -> This is a great program but i think that it would be helpful
to have another mailing list dedicated to CGI so as to separate these issues
from the critical encryption issues. Any takers?
----- Original Message -----
From: "Tom Beidler" <tbeidler@mindspring.com>
To: <gnupg-users@gnupg.org>
Sent: Tuesday, December 12, 2000 1:30 PM
Subject: newbie question "Public key not found" with PHP
> Please CC me. I'm not sure if I'm subscribed yet.
>
> I'm having problems using GNUPG for the first time. I'm using it with PHP
> and I'll show you my code;
>
> // Set directory for "www"'s key ring
> putenv("GNUPGHOME=/var/www/.gnupg");
>
> // Dump email message into indata file
> $fp = fopen("/usr/home/dogma/temp/indata", "w+");
> fputs($fp, $msg);
> fclose($fp);
>
> // encrypt
> system("/usr/local/bin/gpg --encrypt -ao /usr/home/dogma/temp/outdata -r
> 'Joe Schmoe <jschmoe@building.com>' /usr/home/dogma/temp/indata ");
>
> unlink("/usr/home/dogma/temp/indata");
>
> $crypted = "/usr/home/dogma/temp/outdata";
>
> $fd = fopen($crypted, "r");
> $mail_cont = fread($fd, filesize($crypted));
> fclose($fd);
>
> unlink("$crypted");
>
> I keep getting "Public key not found". The key lines are the "putenv"
which
> is the directory of the PHP users key ring and "system" which is the
actual
> command line. I've tried several variations of the public key, ie. 'Joe',
> 'Joe Schmoe', 'jschmoe@building.com'.
>
> I've tried telneting in as myself and encrypting something and I get the
> samething. When I --check-ring it shows that I have both my private and
> public key.
>
> Any help would be appreciated.
>
> Thanks,
> Tom
>
> >>.>>.>>>.>>>>>.>>>>>>>>>
> Tom Beidler
> Orbit Tech Services
> 805.455.7119 (cell)
> 805.682.8972 (phone)
> 805.682.5833 (fax)
> tbeidler@mindspring.com
> >>.>>.>>>.>>>>>.>>>>>>>>>
>
>
> --
> Archive is at http://lists.gnupg.org - Unsubscribe by sending mail
> with a subject of "unsubscribe" to gnupg-users-request@gnupg.org
>
--
Archive is at http://lists.gnupg.org - Unsubscribe by sending mail
with a subject of "unsubscribe" to gnupg-users-request@gnupg.org