views:

32

answers:

2

I have to create a WinZip compatible zip file from a PHP application on a linux box, and it must use AES 256 encryption. I have found a few solutions for PHP on Windows, but they don't help me! A PHP package would be great, but if I need to, I can always have my PHP code run exec() or something to run a linux command line utility.

Any suggestions?

A: 

Winzip and PHP have nothing to do with each other first off. .zip is a file format. On Windows I have had WinZip handle .tar files which Linux creates natively. AES encryption also has nothing to do with the file format.

Woot4Moo
often times people leave a comment for the downvote
Woot4Moo
The question is about CREATING a zip file, not EXTRACTING one. Jason seems to be looking for a way to create a ZIP file with AES encryption, using a PHP script on a server. //EDIT: Yes, apologies for first downvoting and then commenting, should have done it in opposite order.
Pelle ten Cate
tar czf myCustomTar.tar *.myFiles creates a WinZip compatible archive. Therefore it should be trivial to make a system call from a php function. Granted I know nothing of PHP and my linux is limited
Woot4Moo
Pelle ten Cate is exactly right. I need to create a zip file which can be opened by WinZip.
Jason
Woot4Moo - if I can use some other tool to encrypt my files, then use tar to package them, perhaps that would work. But is this compatible with WinZip's AES encryption?
Jason
AES encryption is a type of encryption. I cannot vouche for WinZip's implementation of a well known algorithm
Woot4Moo
A: 
  1. If a Zip application clone is not already installed on your host, just search Google for installing one of a hundred different zip applications capable of supporting both encryption and cross-platform compatibility.
  2. Use `exec` or similar PHP function to call any available external zip application capable of zipping and applying AES-256 encryption to your target file. You'll need to know any command line switches which your zip application requires to make this happen. The target file names within your `exec` string parameter can of course be switched out using variables.
  3. Serve your new zip file

However, should encryption not be a concern, see PHP's Zip class for making generic zip files: http://php.net/manual/en/book.zip.php

bob-the-destroyer