How to decompress an AES-256 Encrypted zip files?

╄→гoц情女王★ 提交于 2019-12-05 06:32:53

zip4j, java library to handle Zip files (Open source, Apache License v2.0).

http://www.lingala.net/zip4j/

  • Create, Add, Extract, Update, Remove files from a Zip file
  • Read/Write password protected Zip files
  • Supports AES 128/256 Encryption
  • Supports Standard Zip Encryption

You can download binary, sources and examples.

I ended up using an external library at http://code.google.com/p/winzipaes/

it's limited to compression/decompression Zip files encrypted with AES-256 ONLY

but at least it fits my need.

It depends on you encoding of encrypted zip files. Be more specific please. If its compress then encrypt then you decompress then decrypt the file using java.util.zip.GZIPInputStream

As far as I remember AES encrypted ZIP files were introduced some years the first time by WinZip. On the WinZip home page there is a detailed explanation how the AES encrypted ZIP files differs from a standard ZIP file:

http://www.winzip.com/aes_info.htm

I am working on a normal JRE. Using http://www.lingala.net/zip4j/ the following code works to decrypt a zip file:

ZipFile zipFile = new ZipFile(zipFile);
zipFile.setPassword(password);
for (Object fileHeaderObj : zipFile.getFileHeaders()) {
  FileHeader fileHeader = (FileHeader) fileHeaderObj;
  String fileName = fileHeader.getFileName();
  ZipInputStream zipIn = zipFile.getInputStream(fileHeader);
  // do whatever with the input stream
}

I don't have tested it yet, but some time ago I found this.

I hope it can help you

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