Page 1 of 1

Help - How Do I Encrypt A File (.CSV) with GnuPG and PHP???

Posted: Sun Sep 26, 2010 7:52 pm
by boon4376
I have a checkout system that takes order information and places it into a .csv file.

I need to encrypt this file using GnuPG so that I can upload it securely to my fulfillment houses ftp server.

I have CPANEL in my hosting account and have setup a key to do some testing with.
I am programming with PHP.

What is sample code I could use to encrypt this file? Do I use the file handle? encrypt using the file's location on the server? I really have no idea what I am doing as far as encrypting files goes and I need some help.

This is code I am using at the moment and it doesn't seem to be doing anything. Keep in mind I have a shared hosting account and my CPANEL has a section built in for creating / managing GnuPG keys so I believe I have the capability setup.

Code: Select all

// Encrypt the file
  $gpg = "/usr/bin/gpg";
  $recipient = "matt@xxxxxxx.com";
  $file = "/csvorders/$file_name";
  
  echo shell_exec("$gpg -e -r $recipient $file");
Thanks ahead of time

Re: Help - How Do I Encrypt A File (.CSV) with GnuPG and PHP

Posted: Sun Sep 26, 2010 11:35 pm
by Christopher
I think there is a PECL Extention, but it might be easier to just exec() gnupg.