Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

class library and security in dotnet technology

Tags:

c#

suppose i have developed class library and i want the i can use this library in my project only but if someone try to copy the dll file and want to use it in his project then he will not be able to do so. so i just want to know how could embed this type of security in the dll file...please tell me all ways. thanks

like image 582
Thomas Avatar asked Dec 22 '22 18:12

Thomas


1 Answers

You could verify in your assembly the PublicKeyToken of the calling signed assembly.

  • How to: Sign an Assembly with a Strong Name
  • Getting an Assembly's Public Key the Programmatic way

The second example is in VB.NET, couldn't find a C# version readily but you'll get the idea.

Be aware that this is not an absolutly secure way, because someone could still decompile your assembly. But if it's just to prevent that your library is used in other projects, this might be an acceptable way.

like image 116
Martin Buberl Avatar answered Jan 31 '23 12:01

Martin Buberl