PGP in PHP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Raphael
Forum Newbie
Posts: 5
Joined: Wed Jun 05, 2002 6:04 am

PGP in PHP?

Post by Raphael »

Hi guys and girl,

I'm new here, and I have just started working with PHP. I have this burning question:

I have a website with a form which uses a mailform.php
In this form you can fill in your stuff like name adress, ans also your creditcard number, cause you can buy stuff online.

I have used a PGP script inside my PHP, to encrypt the Creditcard number.
It's running on a Apache server. But we test it on a Xitama.
Locally PGP freeware 7.0.3 has been installed to generate a keyring.

But when the webmaster receives the email, the creditcard number is gone, empty.
This is the code:
_____________________________________________________________

function pgp_encrypt($keyring_location, $public_key_id, $plain_text) {

$key_id = EscapeShellArg($public_key_id);
putenv("PGPPATH=$keyring_location");

// 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);

return $encrypted_text;
}

$Nummer = pgp_encrypt("/location/pgpkey/", "webmaster@domain.nl", $creditcard);

_____________________________________________________________

Is it because of Xitama server, that it doesn't work?
Does PGP also has to be installed on the server?
Is is because of te version of PGP (I use 7.0.3)?

I hope someone can help me out.

Greeting Raphael
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Right before this:

Code: Select all

return $encrypted_text;
Add:

Code: Select all

print_r($encrypted_text);
To double check that you are getting a result before the function ends.
Raphael
Forum Newbie
Posts: 5
Joined: Wed Jun 05, 2002 6:04 am

Post by Raphael »

Thanks for such a quick response.
I tried it, but nothing is different then before!
:?:
But Ill keep looking.

Greetings Raphael
Post Reply