Blank encrypted messages

Matthew Reeve matt@rangie.com
Wed Apr 23 23:40:02 2003


Hi group,

I have just implemented gnupg to encrypt the contents of a webform and =
email
it. It took a while to get the PHP script to work, but it finally is. I
tried decrypting the block on my local machine (with the private key on) =
and
it comes up as an empty mail.=20

I have already checked that the string being executed contains the =
message
in the code below. Can anyone suggest what I can try to fix this?

The PHP code is as follows...

function _encrypt($msg)=20
{=20
$oldhome =3D getEnv("HOME");=20
putenv("HOME=3D/var/www");=20
$command =3D 'echo "$msg" | /usr/bin/gpg -e -a --always-trust  --batch
--no-secmem-warning -u matt@rangie.com -r matt@rangie.com';
exec($command, $encrypted, $errorcode);=20
putenv("HOME=3D$oldhome");=20
if ($errorcode)=20
{=20
	die( "$errorCode");
} else {
	for ($index =3D 0; $index < ((count($encrypted))); $index++)
	{
		$message .=3D $encrypted[$index];
	}
	return ($message);
}
}=20

Many thanks in advance,

Matthew Reeve