I am developing an android application which requires to decompress an AES-256 encrypted zip files, is there any libraries out there that I can use to accomplish that?
I am greatly appreciative of any guidance or help.
zip4j, java library to handle Zip files (Open source, Apache License v2.0).
- 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:
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
来源:https://stackoverflow.com/questions/4584775/how-to-decompress-an-aes-256-encrypted-zip-files