kidwong
asked on
PHP interact with PGP(2.6.3i)
I am a new user for PGP and PHP, I have installed the PGP 2.6.3i in my computer, running the Mandrake Linux 8.1. The PGP works fine for a single user, that me.
But recently, I need to have a IMAP mail server with PGP to encrypt the email for my friends and other family members through the Internet. I would like to implement it with PHP. However, my PHP program doesn't work for it. It seems that the user id through the PHP is "nobody" in the Linux server. But I don't know how to solve it. Does it need some configuration in PGP (e.g. config.txt)?Please give me a hand. Thank you.
Some of the setting of the Linux server:
PHP 4.0.6
Apache 1.3.20
PGP 2.6.3i
pgp binary in /usr/local/src/pgp
pgp public keyring: /root/.pgp/pubring.pgp
PHP program:
<?
$pgp = "/usr/local/src/pgp";
$tmpdir = "/ramdisk/";
srand((double)microtime()* 1000000);
$randnum = rand(1, 10000000);
$infile = $tmpdir. "tmp-in.". $randnum;
$outfile = $tmpdir. "tmp-out.". $randnum;
$fd = fopen($infile, "w");
fputs($fd, $message);
fclose($fd);
$run = "$pgp -ae $infile (KeyID) -o $outfile";
system($run);
if (file_exists($outfile)) {
$fd = fopen($outfile, "r");
$enoutput = fread($fd, filesize($outfile));
fclose($fd);
}
unlink ($infile);
unlink ($outfile);
?>
But recently, I need to have a IMAP mail server with PGP to encrypt the email for my friends and other family members through the Internet. I would like to implement it with PHP. However, my PHP program doesn't work for it. It seems that the user id through the PHP is "nobody" in the Linux server. But I don't know how to solve it. Does it need some configuration in PGP (e.g. config.txt)?Please give me a hand. Thank you.
Some of the setting of the Linux server:
PHP 4.0.6
Apache 1.3.20
PGP 2.6.3i
pgp binary in /usr/local/src/pgp
pgp public keyring: /root/.pgp/pubring.pgp
PHP program:
<?
$pgp = "/usr/local/src/pgp";
$tmpdir = "/ramdisk/";
srand((double)microtime()*
$randnum = rand(1, 10000000);
$infile = $tmpdir. "tmp-in.". $randnum;
$outfile = $tmpdir. "tmp-out.". $randnum;
$fd = fopen($infile, "w");
fputs($fd, $message);
fclose($fd);
$run = "$pgp -ae $infile (KeyID) -o $outfile";
system($run);
if (file_exists($outfile)) {
$fd = fopen($outfile, "r");
$enoutput = fread($fd, filesize($outfile));
fclose($fd);
}
unlink ($infile);
unlink ($outfile);
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.