简体   繁体   English

如何避免APK资产文件夹资源项文件的逆向工程?

[英]How to avoid reverse engineering of an APK assets folder resources items file?

I am developing a android application, in this application assets folder contains some password and some imp information. 我正在开发一个android应用程序,在这个应用程序assets文件夹中包含一些密码和一些imp信息。 I want to prevent a hacker from accessing any resources, assets or source code from the APK file , Mainly assets resources . 我想阻止黑客从any resources, assets or source code from the APK file访问any resources, assets or source code from the APK file ,主要是assets resources

How can I achieve this thing? 我怎样才能实现这个目标?

I found and also think about following solutions, Please make me correct and provide your suggestions on this. 我发现并考虑以下解决方案,请让我正确并提供您的建议。

1) Put every data or files in assets folder in encrypted way.

In this solution when i require to use this assets folder data then i need to do decryption every time that make my application slow. 在此解决方案中,当我需要使用此资产文件夹数据时,我需要每次使我的应用程序运行缓慢时进行解密。

2) To secure resources, don't include all important resources in the assets folder with APK. Download these resources at the time of application first start up.

This solution also not suitable for my application as i want to use my application in Offline mode if it is going to be use first time or second time. 此解决方案也不适合我的应用程序,因为我想在脱机模式下使用我的应用程序,如果它将第一次或第二次使用。

3) obfuscation would not protect assets folder data so we can not use that.

Please provide your suggestions and inputs on the same. 请提供您的建议和意见。

Any help would be appreciated. 任何帮助,将不胜感激。

Thanks & Regards 感谢和问候

Reverse engineering on Android is REALLY easy ! Android上的逆向工程非常简单! You can't prevent that. 你不能阻止这一点。 You should not store any sensitive informations in your APK because someone could find them easily. 您不应该在APK中存储任何敏感信息,因为有人可以轻松找到它们。

You should use asymmetric encryption if you want to store something on the user device. 如果要在用户设备上存储内容,则应使用非对称加密。

It's possible to hide some data in your code like a symmetric encryption key but it will be found in few minutes if someone want to find it. 可以像对称加密密钥一样隐藏代码中的某些数据,但如果有人想要找到它,可以在几分钟内找到它。 (and few seconds if you put it in assets folder...) (如果你把它放在资产文件夹中,几秒钟......)

EDIT If you want to put a symmetric encryption key in your code, don't set it like : 编辑如果要在代码中放置对称加密密钥,请不要将其设置为:

String myKey = "myEncryptionKey";
byte[] key = myKey.getBytes();

because a reverse engineer is able to list all strings in your apk with a single command... So use something like : 因为反向工程师能够用一个命令列出你的apk中的所有字符串...所以使用类似的东西:

StringBuilder sb = new StringBuilder();
sb.append(m);
sb.append(y);
...
byte[] key = sb.toString().getBytes();

or 要么

byte[] key = Base64.decode("esfas09f8as90f8").getBytes();

Any data which you install on a client device will be accessible to the user. 您在客户端设备上安装的任何数据都可供用户访问。 Tools like Proguard are great for code optimization and may make code slightly less readable but anyone with your APK can reverse engineer the application and access everything which you included on the APK file. 像Proguard这样的工具非常适合代码优化,并且可能会使代码的可读性略低,但是任何拥有APK的人都可以对应用程序进行反向工程并访问您在APK文件中包含的所有内容。

For example, you can store sensitive data in the assets folder which an attacker can access easily, now encrypting this is fine but what key are you using to encrypt it? 例如,您可以将敏感数据存储在资产文件夹中,攻击者可以轻松访问该文件夹,现在加密这个很好但是您使用什么密钥加密它? Where is the key stored? 密钥存储在哪里?

There is another tool called DexGuard which can encrypt strings. 还有另一个名为DexGuard的工具可以加密字符串。 However this has not been a proven defense yet and will only slow an attacker down. 然而,这尚未得到证实,只能减缓攻击者的速度。

In summary never store sensitive data on your App, it cannot be protected. 总之,永远不会在您的应用程序上存储敏感数据,它无法得到保护。

If you want to find out how easy this is, check out the following tools: 如果您想了解这是多么容易,请查看以下工具:

https://code.google.com/p/dex2jar/ https://code.google.com/p/dex2jar/

&

http://jd.benow.ca/ http://jd.benow.ca/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM