我正在使用我放在 Assets 文件夹中的数据库文件和一些文本文件。当任何用户下载我的 APK 文件并解压它时,他将很容易地从 assets 文件夹中获取我的资源。
我怎样才能加密我所有的资源,这样如果有人得到我的资源,他就不能使用它?
最佳答案
假设 Assets 文件已经加密,Java 的 CipherInputStream解密 Assets 文件的内容将有助于您的需求
// Cipher that holds algorithm (E.g. AES)
Cipher cipher = getCipherProbablyAES();
// Get input stream to that file. Handle IOException on your own
InputStream assetFile = getAssets().open("myEncrypted.txt");
CipherInputStream cipherIS = CipherInputStream(assetFile, cipher);
关于android - android中资源的数据加密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34468741/