zip4j: Some files in the encrypted zip can be decompressed, while others cannot

use password, Some files in the encrypted zip can be decompressed, while others cannot. the code :

ZipFile zipFile = null;
  try {
      ZipParameters zipParameters = new ZipParameters();
      zipParameters.setEncryptFiles(true);
      zipParameters.setEncryptionMethod(EncryptionMethod.ZIP_STANDARD);
      zipFile = new ZipFile(zipFilePath, "password");
      zipFile.addFiles(willZipFileList, zipParameters);
  } catch (Exception e) {
      e.printStackTrace();
  }

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Most upvoted comments

I have the same issue with version 2.9.0. It rarely happened. In my case, I zip 5 files. Then I use 7-zip to extract in Window. 4 files can extract with myPassword and 1 file can not. I extract by double click on zipfile and click on each file to extract.

Here is my current method. myPassword contains a special character ‘@’, don’t know if this can cause the problem

val zipFile = ZipFile(File(directory, filename), myPassword.toCharArray())
val parameters = ZipParameters()
parameters.compressionMethod = CompressionMethod.DEFLATE
parameters.compressionLevel = CompressionLevel.NORMAL
parameters.isEncryptFiles = true
parameters.encryptionMethod = EncryptionMethod.ZIP_STANDARD
zipFile.addFiles(myFiles, parameters)
return zipFile.file