Solved

GPG Encryption within PHP

Posted on 2007-12-03
3
490 Views
Last Modified: 2008-02-01
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

0
Comment
Question by:SPC3000
  • 2
3 Comments
 
LVL 18

Expert Comment

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

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_21694913.html?sfQueryTermInfo=1+gpg
0
 
LVL 6

Accepted Solution

by:
ebosscher earned 500 total points
ID: 20400358
try this link: <a href='http://www.phpclasses.org/browse/package/1724.html'>http://www.phpclasses.org/browse/package/1724.html</a>
the guy suggests that he has a php class that will do GnuPG encryption without temporary files, etc.  it may be worth a look
0
 
LVL 6

Expert Comment

by:ebosscher
ID: 20400361
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
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now