如何锁定分布式DLL?
我有一个共享的 .Net DLL,供一些应用程序使用,还有一个可公开使用的 API。我计划分发 API DLL,但由于链接也必须分发共享 DLL。
防止使用不必要的类和数据的最佳选择是什么?
将共享 dll 中未在 API 中使用的所有内容声明为内部内容?
创建一个新的 DLL,其中包含 API 和其他项目之间的所有共享项?
编辑:所有东西都是用 C# 创建的。我还最感兴趣的是向用户提供一个漂亮且友好的 API。据我了解,无论我做什么,用户总是可以使用反射器来查看它。
I have a shared .Net DLL that is used by a few applications and a publicly usable API. I plan to distribute the API DLL, but because of the link have to distribute the shared dll also.
What is the best option to prevent uneccessary classes and data from being used?
Declare everything in the shared dll as internal that is not used in the API?
Create a new DLL that contains all the shared items between the API and the other projects?
Edit: All things have been created in C#. I am also mostly interested in presenting the user with a nice and friendly API. It is my understanding that whatever I do the user could always use reflector to look at it anyways.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你没有提到你要使用什么语言。如果它是一个托管程序集,那么它比您所要求的要多得多。
只需尝试将代码隐藏在内部方法或私有方法后面,代码总是可以被反编译。所以这是你必须处理的首要事情之一。您必须混淆该代码,以便反编译的内容无法理解。
您可以锁定 dll,但这很难完成,并且取决于您的实现程度,这可能根本没有帮助。
我在 RedGate 购买之前就使用过这个产品,非常棒。它击败了我的代码,这些代码是从网络上随机发布的帖子中挑选出来的。但这可能是您想要使用的东西。
http://www.red-gate.com/products/dotnet-development/智能装配/
You didn't mention what language you were going to use. If it's a managed assembly then there is a lot more to it than what you are asking.
Simply trying to hide your code behind internal methods or private the code can always be decompiled. So that's one of the first things you'd have to handle. You have to obfuscate that code so that what gets decompiled is not understandable.
You can lock down the dll but that's very difficult to accomplish and depending on how well your implementation then it might not be helpful at all.
I used this product before RedGate bought it and it was AWESOME. It beat the pants off my code which was culled together from random posts on the web. But it might be something you would want to use.
http://www.red-gate.com/products/dotnet-development/smartassembly/
安全机制的决定是基于资源的重要性。因为通常方法越安全,性能面板就越多。
The security mechanism decision is based on the the importance of the resource. Just because usually the more secure a method is the more is the performance panelty.