Xamarin.Android - 本机代码编译是否使逆向工程更难?

Xamarin.Android - does native code compilation make reverse engineering harder?(Xamarin.Android - 本机代码编译是否使逆向工程更难?)

本文介绍了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 - 本机代码编译是否使逆向工程更难?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Xamarin.Android - 本机代码编译是否使逆向工程更难?

基础教程推荐