Solved

GPG Encryption within PHP

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Log in through ID 5 18
if (is_singular not working 5 18
"Ensure their internet protocol supports SHA-2 certificate" ?? 5 32
Corrupt / Encrypted Word Documents 6 32
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Encryption for Business Encryption (https://en.wikipedia.org/wiki/Encryption) ensures the safety of our data when sending emails. In most cases, to read an encrypted email you must enter a secret key that will enable you to decrypt the email. T…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

829 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