如何在 Android Phonegap 移动应用中加密 HTML+JS 资产? [英] How to encrypt HTML+JS assets in Android Phonegap mobile app?

查看:22
本文介绍了如何在 Android Phonegap 移动应用中加密 HTML+JS 资产?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Phonegap 基本包装器和 HTML5 创建了移动应用程序.我的目标是加密资产目录中的文件(JS 和 HTML 文件),以便解压缩 APK 文件并希望查看 JS 源代码的人无法读取它们.

I have mobile app created using Phonegap basic wrapper and HTML5. My goal is to encrypt files in assets directory (JS and HTML files) so they are unreadable to people, who unzip the APK file and want to see the JS sources.

好吧,我知道没有绝对完美的解决方案.在我回答这个问题的路上,我已经尝试了如何解决我的源代码的复制保护(JS 缩小、混淆等)的选项,但我发现获取原始代码非常简单(使用 JSBeautifier、firebug, 包括混淆的脚本等...).

Ok, i know there is no absolute perfect solution. On my way to this question I've already tried options how to solve copy protection of my sources (JS minification, obfuscation, etc..), but I found out that it's very simple to get to the original code (using JSBeautifier, firebug, including obfuscated scripts, etc...).

所以我的问题是 - 是否有一些简单的方法来加密 JS+HTML 文件(因此在简单地解压缩 APK 文件时它们不可读且有用)以及如何在 Android 平台的 JAVA 中实现它?

So my question is - is there some simple way how to encrypt JS+HTML files (so they are not readable and useful when simply unzipping APK file) and how to implement it in JAVA for Android platform ?

注意:我不了解 JAVA 语言,所以请提供我可以使用的工作示例.

Note: I have no knowledge of JAVA language, so please include working example which I can use.

我在制作最终的 APK 包时也研究了 ProGuard 功能,但它对我来说没有用,因为它只处理 JAVA 文件,但保留了资产目录.

I also investigated ProGuard feature when making final APK package, however it is useless for me, because it only deals with JAVA files, but leaves assets directory as it is.

推荐答案

前段时间我遇到了同样的问题,但在 iOS 上.结果只是在为 iOS 修补 PhoneGap 之后.我在 http://oleksiy.pro/2011/09/20/phonegap-application 写了一篇文章-加密/.另外,对于Android,这种方法可能很弱,因为java代码可能被99%反编译,黑客会看到你的密钥.

Some time ago I have same problem but on iOS. And the result was only after patching PhoneGap for iOS. I have wrote an article at http://oleksiy.pro/2011/09/20/phonegap-application-encryption/. Also, for Android this method could be weak, because java code could be 99% decompiled, and hacker will see your key.

这篇关于如何在 Android Phonegap 移动应用中加密 HTML+JS 资产?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆