我无法使用Java解压缩受密码保护的zipx文件(包含xlsx)。加密方法AES-256 LZMA。
我尝试过Apache Common Compress和Lingla.zip4j。但无法提取。 似乎压缩类型LZMA不支持Lingla.zip4j。
Image: For CRC and Encryption method detail
我还有其他方法可以提取吗?
Apache Common Code
File file = new File("H:\\WorkDoc\\afile.zipx");
byte[] inputData = new byte[(int) file.length()];
FileInputStream fis = new FileInputStream(file);
fis.read(inputData); //read file into bytes[]
fis.close();
String password = "password";
byte[] pass = password.getBytes();
SeekableInMemoryByteChannel inMemoryByteChannel = new SeekableInMemoryByteChannel(inputData);
SevenZFile sevenZFile = new SevenZFile(inMemoryByteChannel, pass);
SevenZArchiveEntry entry = sevenZFile.getNextEntry();
sevenZFile.read(); // read current entry's data
错误
java.io.IOException: Bad 7z signature
at org.apache.commons.compress.archivers.sevenz.SevenZFile.readHeaders(SevenZFile.java:250)
at org.apache.commons.compress.archivers.sevenz.SevenZFile.<init>(SevenZFile.java:165)
at org.apache.commons.compress.archivers.sevenz.SevenZFile.<init>(SevenZFile.java:156)
at org.apache.commons.compress.archivers.sevenz.SevenZFile.<init>(SevenZFile.java:136)
at com.concept.utilities.zip.ApacheComm.main(ApacheComm.java:33)
答案 0 :(得分:0)
根据this blog,net.contrapunctus.lzma包提供了LzmaInputStream和LzmaOutputStream的实现,它们与在不同线程中运行的底层LZMA编码器和解码器进行交互。所以,它可能对你有用。