安卓zip文件认证

4

我想创建一个需要将视频进行压缩并且用户必须通过密码验证才能打开文件的应用程序,这是否可能?

如果可以的话,你们能否提供一些示例代码呢? 谢谢, 问候


8
我知道英语不是你的母语,但这应该鼓励你校对你的问题。并不是我们所有人都是同性恋,所以请把那个词改成“人们”。谢谢。 - Octavian Helm
2个回答

2
尝试类似以下的做法:
OutputStream out = new ZipOutputStream(new CipherOutputStream(new FileOutputStream(...)), cipher);

相反地,还有另一种方式:
InputStream in = new ZipInputStream(new CipherInputStream(new FileInputStream(...)), cipher);

创建密码,请参阅:http://developer.android.com/reference/javax/crypto/Cipher.html

0

我不确定您需要什么,但如果您想拥有受密码保护的 zip 文件,可以使用 this library:这是一些取自那里的代码片段:

Zip:

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

解压缩:

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接