简体   繁体   English

如何加密.zip文件?

[英]How to encrypt a .zip file?

Is it possible to encrypt a Zip file? 是否可以加密Zip文件? I know encryption is used to make .txt files unreadable until decrypted with a key. 我知道加密用于使.txt文件不可读,直到用密钥解密。 Although I want to do the same with a .zip file. 虽然我想对.zip文件做同样的事情。
I have multiple files I want users to download from the internet through my program I'm creating, so I thought I'll compress them files in a .zip and then encrypt the Zip for added security. 我有多个文件,我希望用户通过我正在创建的程序从互联网上下载,所以我想我会在.zip中压缩它们的文件然后加密Zip以增加安全性。 (I don't want users to access the file within the .zip without a serial code) (我不希望用户在没有串行代码的情况下访问.zip中的文件)
I was going to keep the 'serial key' in a database online which the program would get. 我打算将“序列密钥”保存在程序可以获得的数据库中。

Am going about this in the wrong way? 我是以错误的方式解决这个问题的?

DotNetZipSharpZipLib都支持加密拉链内容并且是免费的。

Use the dotnetzip library to perform your zipping/unzipping operations. 使用dotnetzip库执行压缩/解压缩操作。

It supports AES encryption. 它支持AES加密。 From the website: 来自网站:

The library supports zip passwords, Unicode, ZIP64, stream input and output, AES encryption, multiple compression levels, self-extracting archives, spanned archives, and more. 该库支持zip密码,Unicode,ZIP64,流输入和输出,AES加密,多个压缩级别,自解压存档,跨文档等。

Yes you can use third party zip libraries as shown by other answers, but keep in mind that your method of protecting files is rudimentary... it would not be terribly difficult to observe your program operating and recover the files after your program helpfully decrypts them. 是的,您可以使用第三方zip库,如其他答案所示,但请记住,您保护文件的方法是基本的......观察您的程序运行并在程序帮助解密后恢复文件并不是非常困难。 If you are storing the key as a constant in the program, that is pretty trivial to extract as well. 如果您将密钥作为常量存储在程序中,那么提取也是非常简单的。

Software protection is a complex field, and it's very difficult to prevent determined users from viewing data that is stored on systems they control. 软件保护是一个复杂的领域,很难阻止确定的用户查看存储在他们控制的系统上的数据。 Commercial software goes to great lengths to prevent this, and the solutions are quite complicated. 商业软件竭尽全力阻止这种情况,而且解决方案非常复杂。 (eg try hooking a debugger to Skype and see what happens) (例如,尝试将调试器挂钩到Skype,看看会发生什么)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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