问题
I have developed a sample android application using phonegap,If someone reverse engineers the apk file,They can easily get the javascript,html files . What is the best way to secure javascript and html files in the assets folder since i will be defining lot of api keys in the javascript source files which should be hidden.
回答1:
@mahesh
1) 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.
2) You can use a webview and load a base64 string:
protected String base64Str = "+wL00h2L...."; wv1.loadData(base64Str, "text/html; charset=utf-8", "base64");
Thanks
来源:https://stackoverflow.com/questions/24925594/how-to-encrypt-the-content-assets-folder-in-phonegap-android-application