Open thePK opened 10 months ago
Sorry about the format before.
For the encrypted compressed zip file, is it supported to use zinInputstream to decompress it directly? Below is my test code and maven dependency, I received the following error. But the same code will work fine for an unencrypted zip package.
maven dependency:
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>2.9.1</version>
</dependency>
test code:
public static void main(String[] args) {
String srcPath = "E:\\test1.zip";
try {
ZipInputStream zis = new ZipInputStream(new FileInputStream(srcPath), "123".toCharArray());
LocalFileHeader nextEntry = zis.getNextEntry();
while (Objects.nonNull(nextEntry)) {
String fileName = nextEntry.getFileName();
if (!nextEntry.isDirectory()) {
log.info("entry name {}", fileName);
}
nextEntry = zis.getNextEntry();
}
} catch (IOException e) {
e.printStackTrace();
}
}
Error reported:
net.lingala.zip4j.exception.ZipException: Reached end of entry, but crc verification failed for test.txt
For the encrypted compressed zip file, is it supported to use zinInputstream to decompress it directly? Below is my test code and maven dependency, I received the following error. But the same code will work fine for an unencrypted zip package.
maven dependency:
test code: public static void main(String[] args) { String srcPath = "E:\test1.zip"; try { ZipInputStream zis = new ZipInputStream(new FileInputStream(srcPath), "123".toCharArray()); LocalFileHeader nextEntry = zis.getNextEntry(); while (Objects.nonNull(nextEntry)) { String fileName = nextEntry.getFileName(); if (!nextEntry.isDirectory()) { log.info("entry name {}", fileName); } nextEntry = zis.getNextEntry(); } } catch (IOException e) { e.printStackTrace(); } }
Error reported: net.lingala.zip4j.exception.ZipException: Reached end of entry, but crc verification failed for test.txt