I am having an application which need to take data from DB and export as zip file.
Since my zip file needs to be password protected, i checked for some libraries.
I got zip4j as a library which helps me in password encryption and export as zip file.
ZipParameters parameters = new ZipParameters();
parameters.setCompressionMethod(Zip4jConstants.COMP_STORE);
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
parameters.setEncryptFiles(true);
parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
parameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);
parameters.setPassword("example");
But i find some problems.
the exported zip file cannot be extracted using any zip software. only WinZip and 7-zip works perfect in extraction. I dont know why other software fails in extraction. I think the encryption technique AES_STRENGTH_256 is not supported on other softwares. correct me if i am wrong
I need to peform import when user click on the attached file in gmail. So i tried getting the zip file . But it comes as stream
<intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="application/octet-stream" android:host="*" android:pathPattern=".*\\.csv" /> </intent-filter>
But i see that the zip4j library cannot read from stream.
With this issue, can someone help me to implement import the zip file and extract the csv file inside.
Since import is done from gmail, i feel data comes as stream , which we need to get and extract the zip file.