使用PHP创建加密的zip存档 [英] Create an encrypted zip archive with PHP

查看:114
本文介绍了使用PHP创建加密的zip存档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来将.txt文件加密成zip,但是以安全的密码保护方式。我的目标是将此文件发送给我,没有人能够阅读附件的内容。

I am searching for a way to encrypt a .txt file into a zip, but in a secure password protected way. My goal is to email this file to me, without anyone being able to read the content of the attachment.

有人知道一个简单的,最重要的是,安全的方式完成这个我可以创建zip档案,但我不知道如何加密,或者这是多么安全。

Does anybody know an easy, and above all, secure way to accomplish this ? I can create zip archives, but I do not know how to encrypt them, or, how secure this is.

推荐答案

你可以使用这个:

<?php echo system('zip -P pass file.zip file.txt'); ?>

其中pass是密码,file.txt将压缩成file.zip。这应该在Windows和Linux上运行,您只需要获得Windows的免费版本的zip( http://www.info-zip.org/Zip.html#Win32

Where pass is the password, and file.txt will be zipped into file.zip. This should work on Windows and Linux, you just need to get a free version of zip for Windows ( http://www.info-zip.org/Zip.html#Win32 )

这种安全性可以被暴力攻击,字典攻击等等,但这不是那么容易,特别是如果你选择了很长时间,并且很难猜到密码。

This kind of security can be broken by brute force attacks, dictionary attacks and etc. But it's not that easy, specially if you chose a long and hard to guess password.

这篇关于使用PHP创建加密的zip存档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆