开发者

How can I create a WinZip compatible AES-256 encrypted zip file from PHP on Linux?

I have to create a WinZip compatible zip file from a PHP application on a linux box, and it must u开发者_如何学运维se 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?


Not php-specific (this question is highly ranked in google also without php): 7-Zip implements this feature, in my documentation I found this command:

7za a -tzip -pPASSWORD -mem=AES256 target.zip filelist


  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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜