问题描述
有人知道如何禁用对敏感代码的反射吗?
具体是我要做的事情。我在一个集合中有一个方法
我试图阻止使用反射来查看代码。
代码包含我做的硬编码关键字不想以任何
方式看到。
我尝试过使用ReflectionPermissionAttribute但不知道这是否会
做我想做的事。
任何建议/答案都非常感谢。
谢谢
嗯,这里有两件事:
1)代码反思
2)工具中的反编译像Reflector
你不能真的阻止他们中的任何一个。混淆会让它更难以找到东西,但这就是它。
如果你的任何硬编码敏感数据在你的申请,
基本上是安全漏洞。
见了解更多信息。
Jon
Hi, anyone know how to disable reflection on sensitive code?
Here is specifically what I''m trying to do. I have one method in a class
within an assembly I''m trying to prevent using reflection to see the code.
The code contains a hardcoded key word that I do not want to be seen in any
way.
I''ve tried using ReflectionPermissionAttribute but don''t know if this will
do what I want.
Any advice/answer greatly appreciated.
Thanks
Well, there are two things here:
1) Reflection in code
2) Decompilation in tools like Reflector
You can''t really prevent either of them. Obfuscation will make it
harder to find stuff, but that''s about it.
If you''ve got any hard coded sensitive data in your application,
that''s a security flaw, basically.
See http://pobox.com/~skeet/csharp/obfuscation.html for more info.
Jon
这篇关于通过.NET反射器禁用反射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!