Xamarin.Android - 本机代码编译会使逆向工程变得更难吗? [英] Xamarin.Android - does native code compilation make reverse engineering harder?

查看:14
本文介绍了Xamarin.Android - 本机代码编译会使逆向工程变得更难吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在考虑将我们的 C# .NET 应用程序移植到 Android,我已经开始阅读有关 Xamarin.Android 和 Mono 框架的信息.我才刚刚开始 Android 开发.

We are considering porting our C# .NET application to Android, and I have started reading about Xamarin.Android and the Mono framework. I am just beginning with Android development.

我在 http://xamarin.com/android 主页上注意到它声明:

I notice on the main http://xamarin.com/android page that it states:

本机代码高性能编译代码,可完全访问所有本机 API.

这是否意味着生成的代码将是更难逆向工程的本机代码?我们想创建一个类库,其中包含我们的关键算法,如果我们可以将其编译为本地代码以阻止逆向工程,那么我们将不那么害怕移植.

Does this imply that the generated code will be native code that is more difficult to reverse engineer? We would like to create amongst other things a class library that contains our key algorithms, and if we can compile it to native code to hinder reverse engineering, that would make us less fearful of porting.

我已经阅读了其他几篇关于 Android 代码反编译的文章,但并不比混淆的 .net 程序集(在使用 ProGuard 之后)更难反编译.本机代码编译是这些帖子之后的最新功能吗?感谢您的建议!

I have read several other posts about Android code not being much harder to decompile than obfuscated .net assemblies (after using ProGuard). Is native code compilation a recent feature that came after those posts? Thanks for any advice!

推荐答案

目前,Android 下的 Xamarin 无法编译为原生处理器代码.它创建了 .NET p 代码,该代码在 Mono 虚拟机中运行,每个 Xamarin 编译的应用程序都安装了其余的应用程序文件.据我所知,为 Android 创建原生代码的唯一合理方法是使用 Android NDK (http://developer.android.com/tools/sdk/ndk/index.html) 并用 C 或 C++ 编写代码.

Currently, Xamarin under Android does not compile to native processor code. It creates .NET p-code, which runs in a Mono virtual machine, which each Xamarin-compiled app installs with the rest of application files. As far as I know, the only way reasonable way to create native code for Android is to use Android NDK (http://developer.android.com/tools/sdk/ndk/index.html) and write code in C or C++.

我做了一些非正式的基准测试,比较了用 Xamarin 和 Dot42 编译的 C# 中的 Java 和类似代码,以及用于实际应用程序(文本处理)的本机代码.基本上,在该特定应用程序上,来自 Xamarin 的 C# 比 Java 或 Dot42 快约 10-20%,而本机代码则快约 5-6 倍.阅读更多:

I did some informal benchmarks, comparing Java and analogues code in C# compiled with Xamarin and Dot42, and native code, for a real-life app (text processing). Basically C# from Xamarin was about 10-20% faster than Java or Dot42 on that particular app, while native code was about 5-6 times faster. Read more at:

有没有人有基准测试(代码& 结果)比较用 Xamarin C# 和 Java 编写的 Android 应用的性能?

此外,为了保护我的 Android Java 代码免受黑客攻击,我使用了 DexGuard 混淆器 (http://www.saikoa.com/dexguard).但是,我真的不知道对于优秀的黑客来说,反编译和篡改这种混淆代码的难度有多大.DexGuard 当然不会保护 .NET Xamarin 代码,只会保护 Java 代码或其他为 JVM 编译的代码.它甚至不会保护直接编译为 Dalvik VM p-code 的 Dot42 代码(运行所有普通 Android 应用程序的虚拟机,Java 代码也被dexed"并转换为 Dalvik 代码,然后才能在 Android 上运行).

Also, to protect my Android Java code from hacking, I use DexGuard obfuscator (http://www.saikoa.com/dexguard). However, I really don't know how much harder it is for good hackers to de-compile and tamper with such obfuscated code. DexGuard will not protect .NET Xamarin code of course, only Java code or other code compiled for JVM. It won't even protect Dot42 code, which compiles directly to Dalvik VM p-code (the virtual machine all normal Android apps run in, Java code is also "dexed" and converted to Dalvik code before it can run on Android).

格雷格

这篇关于Xamarin.Android - 本机代码编译会使逆向工程变得更难吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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