【问题标题】:Data encryption for the resources in androidandroid中资源的数据加密
【发布时间】:2015-12-26 05:24:11
【问题描述】:

我正在使用已放入 Assets 文件夹中的数据库文件和一些文本文件。当任何用户下载我的 APK 文件并将其解压缩时,他将轻松地从 assets 文件夹中获取我的资源。

如何加密我的所有资源,这样如果有人得到我的资源,他就不能使用它?

【问题讨论】:

  • 您可以根据您的应用程序可用性选择加密级别。但可能会使用内部 Java 加密类
  • 您可以使用AES加密java类来加密和解密您的资源
  • 考虑一下这会有多有效。无论应用程序能做什么,攻击者也能做到。

标签: android android-assets


【解决方案1】:

假设资产文件已经加密,Java 的 CipherInputStream 解密资产文件的内容将有助于您的需要

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

【讨论】:

    猜你喜欢
    • 2011-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多