开发者

Android zip file authentication

开发者 https://www.devze.com 2023-01-24 12:31 出处:网络
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 ?

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 ? Than开发者_开发技巧ks , Regards


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


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号