简体   繁体   English

如何在Java中创建受密码保护的zip文件夹?

[英]How to create a password-protected zip folder in Java?

It is important that the zip file should be password protected and not the files contained inside the zip. 重要的是,压缩文件应该受密码保护,而不是压缩文件中包含的文件。 It means that when I double-click on the zip file it should ask me the password before showing the contents of the zip. 这意味着,当我双击zip文件时,在显示zip内容之前应先询问我密码。

I have tried Zip4j and Winzipaes libraries but they both encrypt the content files inside the zip, not the zip itself. 我尝试过Zip4jWinzipaes库,但是它们都对zip内的内容文件进行加密,而不是对zip本身进行加密。 I have also tried several answers from Stackoverflow but to no avail. 我也尝试了Stackoverflow的几个答案,但无济于事。 Please help. 请帮忙。

As stated here by WinZip, the Zip format encrypts the files inside the archive only and not the zip itself. 如WinZip所述,Zip格式仅加密存档中的文件,而不压缩zip本身。 http://kb.winzip.com/kb/entry/147/ http://kb.winzip.com/kb/entry/147/

However, as the article suggests, double zipping the archive will hide files inside the inner zip file. 但是,正如文章所建议的那样,对存档进行两次压缩会将文件隐藏在内部zip文件中。 As long as you encrypt the outer archive. 只要您加密外部存档。

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

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