Jutikorn
Jutikorn

Reputation: 848

Android zip file authentication

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

If it poosible , could you guys provide me some of example code ? Thanks , Regards

Upvotes: 4

Views: 1764

Answers (2)

Milad Faridnia
Milad Faridnia

Reputation: 9477

I'm not sure what you exactly 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);

Unzip:

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

Upvotes: 0

Timo Ohr
Timo Ohr

Reputation: 7947

Try something like this:

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

And the other way around:

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

For creating the cipher, see: http://developer.android.com/reference/javax/crypto/Cipher.html

Upvotes: 2

Related Questions