我即将发布一个应用程序,该应用程序在 Assets/文件夹中包含大量 JavaScript。我已将所有内容 (JS) 缩小到最小并合并为一个大约 500kb 的大文件。我正在寻找对其进行加密并将其从 Assets 文件夹中隐藏的方法。
您认为最好的方法是什么?
在 Java 类中存储为纯字符串,并且(我不知道是否可能)告诉 proguard 对其进行专门加密。 --> 我会把它提供给
WebView
通过onintercepturlloading
在 Assets 中存储为加密文件,使用任何第三方或 Java 加密例程进行热解密 - 我想听听。
随心所欲
理想情况下,该解决方案应包含在构建过程中,但如果没有其他解决方案,我会手动生成加密数据。
编辑:DexGuard 似乎是专业的选择,但价格为 350 欧元,有免费的替代品吗?
请不要问我为什么要加密它。我需要这样做,就像有一天你需要去看牙医一样。
最佳答案
我建议您不要依赖第三方工具,因为您可能会被供应商锁定,这意味着如果他们停止开发软件等。我会将 Javascript 的内容放入一个大的最终静态 String
中,然后正如您所说,告诉 Proguard 发挥它的魔力。
取自 Proguard 的 documentation .
Does ProGuard encrypt string constants?
No. String encryption in program code has to be perfectly reversible by definition, so it only improves the obfuscation level. It increases the footprint of the code. However, by popular demand, ProGuard's closed-source sibling for Android, DexGuard, does support string encryption, along with class encryption and hiding of access to sensitive APIs.
关于android - 如何加密 Assets ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15271504/