Android zip file authentication

Is it possible if I want to create my application that needs to fasten the video and the user must have password authentication to open the file?

If it's poosible, could you guys provide me some sample code? Thanks, Relationship

+4
source share
2 answers

Try something like this:

OutputStream out = new ZipOutputStream(new CipherOutputStream(new FileOutputStream(...)), cipher); 

And vice versa:

 InputStream in = new ZipInputStream(new CipherInputStream(new FileInputStream(...)), cipher); 

To create encryption see: http://developer.android.com/reference/javax/crypto/Cipher.html

+2
source

I'm not sure what you need, but if you want to have password protected zip files, you can use this library : Here are some code snippets taken from there:

Zip:

 ZipArchive zipArchive = new ZipArchive(); zipArchive.zip(targetPath,destinationPath,password); 

Unpack:

 ZipArchive zipArchive = new ZipArchive(); zipArchive.unzip(targetPath,destinationPath,password); 
0
source

All Articles