Solved

GPG Encryption within PHP

Posted on 2007-12-03
3
496 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Expert Comment

by:Mark Gilbert
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 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