Protect my class Libraries, can I?

C

Cablito

Is there a way to protect my class libraries?

I have for instance, a class library full of my base forms and classes
latter inherited by various projects.

A lot of logic is within those objects and I´d hate to see other companies
or individuals being able to add my DLLs to their .NET solution and using it
at will.
 
R

richlm

You could use
"System.Security.Permissions.StrongNameIdentityPermissionAttribute"
You will need to sign all your assemblies that call the ones you want to
protect with the appropriate key.
Any "foreign" assemblies that try to call your protected ones should get a
security exception.

You can use the attribute at assembly, class, constructor or method level.

It's not impossible to circumvent but better than nothing.
 
O

Olaf Baeyens

You could use
"System.Security.Permissions.StrongNameIdentityPermissionAttribute"
You will need to sign all your assemblies that call the ones you want to
protect with the appropriate key.
Any "foreign" assemblies that try to call your protected ones should get a
security exception.

You can use the attribute at assembly, class, constructor or method level.

It's not impossible to circumvent but better than nothing.

Are you sure about this?
I assume that you must also add this, since strong naming will not prevent
VS to use your controls in your strong named dll:

using System.Security.Permissions;


[StrongNameIdentityPermission(SecurityAction.InheritanceDemand,PublicKey="00
24000004....1")]
[StrongNameIdentityPermission(SecurityAction.LinkDemand,PublicKey="0024000
004....1")]
public class MyClass : {
....
}

Note: Do not use SecurityAction.LinkDemand for drag&drop controls intended
to be used by VS since it generates some permission error. This is logical
since VS has a different public key.
 
J

Jonathan Allen

Write good license agreements, slap a bunch of copyrights on it, and be
prepared to hire a lawyer. There is no way to truly protect source code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top