Encrypting a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ClarenceC
Forum Newbie
Posts: 2
Joined: Tue Feb 17, 2009 11:02 pm

Encrypting a file

Post by ClarenceC »

Well no one in the security section seems to have any advice so I will post this here. I have a simple file upload form allows my clients to upload the file on the server. Then through the admin section I can download it. How can I make the file get encrypted when the clients upload it, then decrypt when I download it????
jason.carter
Forum Commoner
Posts: 35
Joined: Sat Jan 10, 2009 10:05 am

Re: Encrypting a file

Post by jason.carter »

Try this

?php
$gpg = '/usr/bin/gpg';
$recipient = 'john@doe.com';
$secret_file = 'secret_file.txt';

echo shell_exec("$gpg -e -r $recipient $secret_file");
?>

See http://devzone.zend.com/node/view/id/1265
Post Reply