Jump to content

Encrypting form data with GnuPG


Recommended Posts

Hello!

 

I'm trying to get my PHP form processor to encrypt the data using GnuPG.

 

$gpg = 'usr/bin/gpg';
$recipient = '[email protected]';
$encrypted_message = base64_encode(shell_exec("echo $message | $gpg -e -r $recipient"));

 

What I get in return is "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING" for the first or second line. I wonder why? Could it be that the path to the binary is wrong?

 

I have tried using double quotes and changing the variables names.

 

Could you help please?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/40836-encrypting-form-data-with-gnupg/
Share on other sites

$gpg = 'usr/bin/gpg';
$recipient = '[email protected]';
$tmp = "echo $message | $gpg -e -r $recipient";
echo $tmp;
$tmp2 = shell_exec($tmp);
echo $tmp2;
$encrypted_message = base64_encode($tmp2);

 

try this.

 

Also try cutting and pasting whatever $tmp is echo'd as onto the command line to see if it works.

 

monk.e.boy

 

What seems to be the problem with my original script?

 

I'm new to PHP so I basically copied it from a "respectable" source... Isn't it just about the syntax?

 

Thanks

 

Duh.

 

What did you think I was asking the questions for? I was trying to help you find the bug in your original script.

 

I guess I could brush you off with a 'learn to program' answer  ;)  ;)

 

monk.e.boy

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.