In .NET 1.x, you could use the StrongNameIdentityPermissionAttribute on your assembly to ensure that only code signed by you could access your assembly. According to the MSDN documentation,
In the .NET Framework version 2.0 and later, demands for identity
permissions are ineffective if the calling assembly has full trust.
This means that any application with full trust can just bypass my security demands.
How can I prevent unauthorized code from accessing my assembly in .NET 2.0?
Best Answer
As per Eric's suggestion, I solved it by checking the key myself. In the code I want to protect, I add the following call,
Then the implementation of that method is
** Names and keys changed to protect the innocent. Any likeness to real names or companies is merely a coincidence.*