Zip & Encryption in PHP
| From: | sumoraigabe-pecl at yahoo dot com | Date: | Mon, 25 Oct 2004 19:04:41 +0000 |
| Subject: | Zip & Encryption in PHP | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-1532@lists.php.net to get a copy of this message | ||
I recall a discussion that touched on encrypted Zip
file support some months back. I can't remember who it
was who asked about it, but I've found a decent
solution.
Info-Zip has a zcrypt "plugin" for the zip/unzip
commands. Download the zcrypt, unzip and zip source
packages from
http://www.mirrorservice.org/sites/ftp.info-zip.org/pub/infozip/src/.
Copy the crypt.h and crypt.c files from zcrypt into
the zip and unzip source trees and when you build
those two utilities they will have encrypted zip file
support. ('make -f unix/Makefile generic' should work)
The -e option is added to the zip command to encrypt
the contents. It seems to require an interactive
terminal to enter the password. I was only interested
in unzip, which takes the password via the command
line. ('unzip -P password file.zip')
I tested it with the ZIP+4 data from the USPS and it
decrypted the data fine.
I'm not sure if this code can be used with the
existing PHP Zip extension or not, but at the least,
the command line tools seem to work just fine.
- Gabriel
=====