如何使用zip4j加密zip文件 [英] How to encrypt zip file using zip4j

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

问题描述

我想创建受密码保护的ZIP:

I want to create password protected ZIP:

    // Set the compression level
    parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);

    // Set the encryption flag to true
    // If this is set to false, then the rest of encryption properties are ignored
    parameters.setEncryptFiles(true);

    // Set the encryption method to Standard Zip Encryption
    parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_STANDARD);

    // Set password
    parameters.setPassword(password);

但这只是加密zip文件中的文件,但我可以在其中打开此zip和监视文件

but this just encrypt files inside of zip but I can open this zip and watch file inside it

推荐答案

由于专利问题,Zip4j不支持加密文件列表。

Zip4j does not support the encryption of the file list because of patent issues.

请参阅: http://www.lingala.net/zip4j /forum/index.php?topic=104.0

更新:

如链接中所述。 zip规范不包括文件列表的加密。要隐藏文件名,您可以创建一个zip文件,包括您的文件再次通过zip封装它。因此,如果您打开zip2.zip,您将只看到zip1.zip而不是原始文件名。

As stated in the link. The zip-specification does not include the encryption of the filelist. To hide the filenames you can create a zip-file including your files encapsulate it by zip it again. Hence if you open zip2.zip you will only see "zip1.zip" and not the original filenames.

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

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