Android - unpacking ZIP files with a password

Can I unzip files encrypted with a password?

I have a search and cannot find any examples or references in the docs.

A link to documents or code samples will be great.

Thanks,

Mike

+6
source share
2 answers

You are right, the java.util.zip package does not support encryption and password decompression functions. You must find other ways to implement this yourself. I really helped find a little if you find this link useful :) http://blog.alutam.com/2009/10/31/reading-password-protected-zip-files-in-java/

+5
source

Refer to this question:

How to unzip a password protected file in Android

It uses zip4j lib, which works fine on Android:

try { File src = new File("/sdcard/abc.zip"); ZipFile zipFile = new ZipFile(src); if (zipFile.isEncrypted()) { zipFile.setPassword("a"); } String dest = new String("/sdcard/abc"); zipFile.extractAll(dest); } catch (ZipException e) { e.printStackTrace(); } 
+4
source

Source: https://habr.com/ru/post/887625/


All Articles