Link to home
Start Free TrialLog in
Avatar of SPC3000
SPC3000

asked on

GPG Encryption within PHP

Hi Guys,

I am having some problems using GPG from within PHP. Basicly my situation is this: Our system needs to create a file with customers direct debit details, encrypt them with PGP (GnuPG), then FTP to a remote server for validation and get a success or error message. This has to be done in real time so the DB is set up as the order is accepted.

What is the best way to encrypt the data? I am trying to use shell_exec using the following command:

(see code snippet)

This just doesnt work at all. No output, nothing echo'd out, etc. PHP Safe mode is off. The files are readable/writable.

When I run the exact same command from SSH logged in as a regular user, it creates the gpg file just fine.

Can anyone help?

echo shell_exec("/usr/bin/gpg -e --homedir {home_dir} -r 0xDAC60875 -o {path_to_output} {path_to_original_data}");

Open in new window

Avatar of Mark Gilbert
Mark Gilbert
Flag of United States of America image

Hi, I did a search on EE for gpg and found the following which I believe will help you:

https://www.experts-exchange.com/questions/21694913/PHP-and-GnuPG-Encryption.html?sfQueryTermInfo=1+gpg
ASKER CERTIFIED SOLUTION
Avatar of ebosscher
ebosscher

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ebosscher
ebosscher

nice, i forgot this does automagic links.  it's been too long since i've posted.  here's the link again: http://www.phpclasses.org/browse/package/1724.html