Open password protected ZIP in Android?

徘徊边缘 提交于 2019-12-19 11:19:51

问题


is there an library or a simple way how to open a password protected ZIP archive in Android? I know there are different types of ZIP encryption. I would like to open the most simple one, create in Unix with the zip -e command. The same file can be opened in Windows (which will ask for password). That should be the standard ZIP 2.0 encryption? How can I open it?

I search for all alternatives but I didn't find any final solution.


回答1:


I found a .jar library that works on Android and can decompress and decrypt ZIP 2.0 files. http://www.lingala.net/zip4j/download.php

It worked for me (encrypted ZIP created in Ubuntu and decrypted in Android).

There might be a way to get it done without any library as described here: Implementation of ZipCrypto / Zip 2.0 encryption in java, but I was not able to get this code to work.




回答2:


Check out http://code.google.com/p/winzipaes/

And there are several questions here tagged in Java dealing with Zip encryption you might look at.




回答3:


You can also take a look at this library that can zip and unzip files with password easily:

Unzip:

ZipArchive zipArchive = new ZipArchive();
zipArchive.unzip(targetPath,destinationPath,password);

The documentation of this library is good enough, I just added a few examples from there. It's totally free and wrote specially for android.



来源:https://stackoverflow.com/questions/6750569/open-password-protected-zip-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!