如何创建普通的受密码保护的ZIP存档? [英] How to create a normal password-protected ZIP archive?
问题描述
我的应用压缩了几个文件,将压缩文件保存到SD卡,然后通过电子邮件将压缩文件发送到一个地址.
My app zips several files, saves the zip file to the SD card, and it emails the zip file to an address.
使用以下代码进行压缩:使用Android(以编程方式)压缩文件.
The zipping is done with this code: Zipping Files with Android (Programmatically).
现在的问题是,我如何在zip文件中输入密码,以便在计算机(Windows,Mac或Ubuntu)上打开该文件的授权人员能够使用提供的密码提取文件?
Now the question is, how do I put a password on the zip file so that authorized individuals who opens it on a computer (Windows, Mac, or Ubuntu) would be able to extract the files with a supplied password?
我阅读了这篇文章: Android zip文件身份验证,但对我来说听起来像是的拉链是用另一部手机完成的...还是我错了? 如果有人知道,请告诉我!谢谢!
I read this post: Android zip file authentication, but it sounds to me that reading of the zip is done with another phone... or am I wrong? If anybody knows please let me know! Thanks!
推荐答案
由于Android具有JVM,因此您可以尝试使用对Java看到的所有lib(有些可以运行,有些不能运行,而某些库的更改会也可以).
since Android has a JVM , you can try to use all lib that you see for java (some will run , some not , and some changes of some library will be ok too) .
这样,我将复制过去此回答问题(用Java编写受密码保护的Zip文件):
This way i'll copy past this answer fo the question (Write a password protected Zip file in Java):
经过大量搜索,我发现了三种方法:
After much searching, I've found three approaches:
可免费获得的一组源代码,适用于单个文件zip. 但是,没有许可证.用法是 AesZipOutputStream.zipAndEcrypt(...). http://merkert.de/de/info/zipaes/src.zip ( https://forums.oracle.com/forums/thread.jspa?threadID = 1526137 )
A freely available set of source code, suitable for a single file zip. However, there is no license. Usage is AesZipOutputStream.zipAndEcrypt(...). http://merkert.de/de/info/zipaes/src.zip ( https://forums.oracle.com/forums/thread.jspa?threadID=1526137 )
更新:此代码现已获得Apache许可,并在以下位置发布 http://code.google.com/p/winzipaes/.它对我有用(一个文件在 zip),并很好地填补了Java开放源代码库中的一个空白.
UPDATE: This code is now Apache licensed and released at http://code.google.com/p/winzipaes/ . It worked for me (one file in the zip), and fills a hole in Java's opens source libraries nicely.
一种商业产品(在撰写本文时为500美元).我无法验证 这是可行的,因为他们的试用许可证方法很复杂.它也是 移植的.NET应用程序: http://www.nsoftware.com/ipworks/zip/default .aspx
A commercial product ($500 at the time of writing). I can't verify if this works, as their trial license approach is complex. Its also a ported .NET app: http://www.nsoftware.com/ipworks/zip/default.aspx
一种商业产品(在撰写本文时为290美元).仅适用于 Wnidows使用dll: http://www.example-code.com/java/zip.asp
A commercial product ($290 at the time of writing). Suitable only for Wnidows as it uses a dll: http://www.example-code.com/java/zip.asp
您还必须知道,将它们适应Android可能并不容易,但是也许您很幸运,其中一些将立即为您运行.
祝你好运!
这篇关于如何创建普通的受密码保护的ZIP存档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!