Solved

GPG Encryption within PHP

Posted on 2007-12-03
3
492 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
When the confidentiality and security of your data is a must, trust the highly encrypted cloud fax portfolio used by 12 million businesses worldwide, including nearly half of the Fortune 500.
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

911 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

19 Experts available now in Live!

Get 1:1 Help Now