I have used zip4j to zip certain files. It is able to properly zip and while extracting it asks for password also. So far so go. Now problems I am facing
- After encrypting with password you can see the file name if you open by 7zip [is there any way to hise this?]
- You can add new files to the zip, simply open it by 7zip and drag a new file it will be add, and allows to extract also particularly that file without password. [ need to disable this?]
My requirement is to lock some files and user should not able to manipulate with the zip . (point 1 is ignore able also )
I there any other was then this ?
final ZipFile zipFile = new ZipFile(outputFile);
final ArrayList filesToAdd = new ArrayList();
for (final String file : fileList) {
filesToAdd.add(new File(file));
}
// Initiate Zip Parameters
final ZipParameters parameters = new ZipParameters();
parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE); // set compression method to
// deflate compressio
// Set the compression level.
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
parameters.setEncryptFiles(true);
// Set the encryption method to Standard Zip Encryption
parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_STANDARD);
// Set password
parameters.setPassword(password);
zipFile.addFiles(filesToAdd, parameters);