Hi,
I am trying to get some basic encryption done using PHP and PGP. I am running an Apache server on a Win2k machine. I am running in CGI mode in order for the PHP system() command to work (which will not work in windows otherwise!). My code is as follows:
<?php
//set the environment variable for PGPPATH
//putenv("PGPPATH=C:/PGP");
//generate token for unique filenames
$tmpToken = md5(uniqid(rand()));
//create vars to hold paths and filenames
$plainTxt="C:/temp/"."$tmpToken"."data";
$crypted="C:/temp/"."$tmpToken"."pgpdata";
$fp = fopen($plainTxt, "w+");
fputs($fp, $msg);
fclose($fp);
//invoke PGP
system("pgp -kc");
system("pgp -e $plainTxt \"Kevin Connolly\" -o $crypted");
//open file and read encrypted contents into var
$fd = fopen($crypted, "w+");
fclose($fd);
?>
which some of you may notice is a scaled down version of the page on Julie Meloni's tutorial. When I run this I get the following error:
Key ring: 'C:\WINNT\Profiles\Default User\Application Data\PGP\pubring.pkr' Type bits keyID Date User ID 0 matching keys found. KeyID Trust Validity User ID Recipients' public key(s) will be used to encrypt. Cannot find the public key matching userid 'Kevin Connolly' This user will not be able to decrypt this message. Encryption error For a usage summary, type: pgp -h For more detailed help, consult the PGP User's Guide.
I have checked and the pubring.pkr does conatain keys! I typed pgp -kc at the command line from the web server user directory (ie 'C:\WINNT\Profiles\Default User\Application Data\PGP) and it returned the correct result (ie a long list of keys!) From what I have read I think I need to create a public and secret keyring for the webserver user (?) but don't know how to do it!! Is this right?
Any help is much appreciated!
Kev.