如何在 Linux 上从 PHP 创建 WinZip 兼容的 AES-256 加密 zip 文件?

发布于 2024-09-28 18:46:51 字数 192 浏览 2 评论 0原文

我必须从 Linux 机器上的 PHP 应用程序创建一个与 WinZip 兼容的 zip 文件,并且它必须使用 AES 256 加密。我在 Windows 上找到了一些 PHP 解决方案,但它们对我没有帮助! PHP 包会很棒,但如果我需要,我总是可以让我的 PHP 代码运行 exec() 或其他东西来运行 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧时模样 2024-10-05 18:46:52
  1. 如果您的主机上尚未安装 Zip 应用程序克隆,只需在 Google 中搜索安装能够支持加密和跨平台兼容性的一百种不同 zip 应用程序之一。
  2. 使用 `exec` 或类似的 PHP 函数来调用任何可用的外部 zip能够压缩目标文件并将 AES-256 加密应用到目标文件的应用程序。您需要了解 zip 应用程序实现此操作所需的任何命令行开关。当然可以使用变量切换“exec”字符串参数中的目标文件名。
  3. 提供新的 zip 文件

但是,如果不担心加密,请参阅用于制作通用 zip 文件的 PHP Zip 类: http://php.net/manual/en/book.zip.php

  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

物价感观 2024-10-05 18:46:51

不是特定于 php 的(这个问题在没有 php 的情况下在 google 中也排名很高):
7-Zip 实现了这个功能,在我的文档中我发现了这个命令:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文