简体   繁体   English

我可以将本机编译用作Java模糊处理吗

[英]Can I use native compilation as Java obfuscation

I am writing a plugin for a Java application. 我正在为Java应用程序编写插件。 I could obfuscate the plugin, but it would still be easily reverse engineered. 我可以混淆插件,但是仍然可以轻松地对其进行反向工程。

I believe that if I could compile this plugin to a shared library, which heavily uses JNI to communicate with the main application, it would be much harder to reverse engineer. 我相信,如果我可以将该插件编译为一个共享库,该共享库大量使用JNI与主应用程序进行通信,则反向工程将变得更加困难。 I am willing to sacrifice some performance to JNI, and the application I am coding against does support shared library loading. 我愿意为JNI牺牲一些性能,而我正在编写的应用程序确实支持共享库加载。 The only problem is that I am not aware of a tool which does the job: gcj seems to depend on its own runtime and IKVM.NET - on .NET 唯一的问题是我不知道执行此操作的工具:gcj似乎依赖于它自己的运行时和IKVM.NET-在.NET上

To be precise: 确切地说:


public class PluginImpl implements Plugin {
    @Override
    public void startPlugin(PluginContext ctx) {
       ctx.helloWorld();
    }  
}

should be converted to 应该转换为


public class PluginImpl implements Plugin {
    @Override
    public native void startPlugin(PluginContext ctx);
}

and the body of my startPlugin method is compiled into a shared library. 然后将我的startPlugin方法的主体编译到共享库中。

(well, yes, I know, I could have written this plugin in C in first place) (嗯,是的,我知道,我本来可以用C编写此插件的)

You can't really use anything for code obfuscation if you are distributing executable code in any form. 如果您以任何形式分发可执行代码,则您实际上不能使用任何东西进行代码混淆。 Any executable code can be reverse engineered. 任何可执行代码都可以进行反向工程。 This is a business problem not a technical problem, and it is solved by busniess means: licence agreements, price, time to market, or most probably a more realistic assessment of the risks and values, ie admitting to yourself that your code just isn't that valuable. 这是一个业务问题,而不是技术问题,可以通过商务手段解决:许可协议,价格,上市时间,或者更可能是对风险和价值的更现实的评估,即向自己承认您的代码就是“那很有价值。 Alternatively deliver your product as a service rather than as an executable. 或者,将产品作为服务而不是可执行文件交付。

I assume you have good reasons to go for native compilation. 我认为您有充分的理由进行本机编译。 An option that you can examine is Excelsior JET that is a Certified Java solution. 您可以检查的一个选项是Excelsior JET ,它是Java认证的解决方案。

You could make your plugin provide its service over RMI . 您可以使您的插件通过RMI提供其服务。 This way the plugin would be an application and could be compiled to native code. 这样,插件将是一个应用程序,并且可以编译为本地代码。

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

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