simple encrypt/decrypt

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
comm
Forum Newbie
Posts: 5
Joined: Fri May 14, 2010 3:51 am

simple encrypt/decrypt

Post by comm »

Hello!
I was wondering if there is any simple encrypt/decrypt module in PHP
Actually I wanted to have few simple features:
- encrypt/decrypt few files/directories in one package
- decrypt one selected file from package
- browse files in package

It reminds me Archives in windows where you can encrypt archive
But in Linux as I known you cant do that

I was using tar with gpg but this is wasn't to comfortable
because gpg doesn't support browse and decrypt only one item from many

Encrypt can be very simple and weak
Thanks
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: simple encrypt/decrypt

Post by Apollo »

Storing multiple files into one archive, and encrypting data, are two completely different tasks.
Sure, they're typically combined when creating protected archives, but from PHP's point of view, are you sure you need it both together?

Besides, exactly what do you mean with 'browse files in package' when you are looking for a PHP module?

Anyway, you may wanna take a look at PHP's mcrypt functions and the ZipArchive class.

By the way, of course there are tons of programs that can do this in Linux as well, including free and open source solutions like 7-zip or PeaZip.
comm
Forum Newbie
Posts: 5
Joined: Fri May 14, 2010 3:51 am

Re: simple encrypt/decrypt

Post by comm »

fortunately ZipArchive doest support encrypting

"browse in the package"
It is feature that helps me get list of files in the package and decrypt only few of them
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: simple encrypt/decrypt

Post by Weirdan »

comm wrote:fortunately ZipArchive doest support encrypting

"browse in the package"
It is feature that helps me get list of files in the package and decrypt only few of them
And what prevents you from encrypting files individually before putting them to zip archive? This would allow to list contents and extract individual files (you will need to decrypt the after extraction).
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: simple encrypt/decrypt

Post by kaisellgren »

I think he wants to encrypt the contents based on the official Zip format/standard. That is, you could extract the archive using your desktop application by providing the password, which PHP used to encrypt the archive.
Post Reply