PGP and PHP

Hey folks,

I've been trying to get PGP working with my PHP script for the past few days now. It's working, to a degree. It's encrypting the text, but when I try to decrypt it with PGP 9.0, I get the message "1 unknown key(s)". Does this sound like a problem with my PHP code, or with my PGP desktop set-up? Is there any way I can find out WHAT key it does contain so that I can see if that's the problem?

Here's my code:

Code:
global $mail_cont;

$key_id = EscapeShellArg($public_key_id);
putenv("PGPPATH=$pgp_path");
		
// encrypt the message
$pipe = popen("pgpe -r $key_id -af", "r");              
		
fwrite($pipe, $plain_text);
$encrypted_text = '';
		
while($s = fgets($pipe, 1024)) {
	// read from the pipe
	$encrypted_text .= $s;
}
		
pclose($pipe);
		
$mail_cont = $encrypted_text;
return $mail_cont;
This could be where my problem is:

Code:
pgpe -r $key_id -af
Does anyone seen any errors in that? The key is a simple e-mail address.

Thanks for any input,
Jon

 

 

 

 

Top