如何保护/加密您的Java类? [英] How can you protect/encrypt your Java classes?

查看:144
本文介绍了如何保护/加密您的Java类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前段时间,在我的工作中,我需要保护一些班级免于别人阅读代码。为此,我创建了一个EncryptedClassLoader,它加载了先前加密的类,并且可以加载正常(未加密)类。
以这种方式工作有点复杂,测试(编译,然后加密,然后解密)。



有没有任何可用的框架做什么我需要,很容易处理?我的意思是,不仅模糊,而且加密文件,所以没有人可以读取或调试那部分代码。这也是非常好的,我可以轻松地更改加密密钥(在我的应用程序中,它是硬编码的)。



提前感谢

解决方案

简短的回答,你不能。加密不起作用这是一篇古老的文章,说明为什么它是不用使用加密的类加载器


不幸的是,你会错了,
都认为你是
首先提出这个想法,在
认为它实际上有效。而
的原因与您的加密方案的
优势无关。


您可以模糊它,但这只会到目前为止,最后我坚信你的时间会更好地修复错误或添加功能。


Some time ago, in my work I needed to protect some classes against other people to read the code. For that purpose, I created a EncryptedClassLoader, that loaded previously encrypted classes, and can load normal (not encrypted) classes as well. Working in that way was a little complicated, and testing too (compile, then encrypt, and then decrypt).

Is there any free framework to do what I needed, and is easy to handle? I mean, not only obfuscate, but also encrypt the files, so none can read or debug that part of code. It would also be great that I can change the keys for encryption easily (in my application, it was hardcoded).

Thanks in advance.

解决方案

Short answer, you can't. Encryption doesn't work. Here's an oldish article about why it's pointless to use an encrypted class loader:

Unfortunately, you would be wrong, both in thinking that you were the first to come up with this idea and in thinking that it actually works. And the reason has nothing to do with the strength of your encryption scheme.

You can obfuscate it, but that will only go so far, and in the end I'm a firm believer that your time would be better spend fixing bugs or adding features.

这篇关于如何保护/加密您的Java类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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