简体   繁体   中英

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 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?

不是特定于PHP的(这个问题在google中排名很高而且没有php):7-Zip实现了这个功能,在我的文档中我找到了这个命令:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM