all groups > dotnet faqs > september 2004 >
You're in the

dotnet faqs

group:

Protect my class Libraries, can I?


Protect my class Libraries, can I? Cablito
9/20/2004 10:30:01 AM
dotnet faqs:
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.


Re: Protect my class Libraries, can I? richlm
9/21/2004 10:24:39 PM
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.

Re: Protect my class Libraries, can I? Olaf Baeyens
9/22/2004 11:10:48 AM
[quoted text, click to view]

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.

Re: Protect my class Libraries, can I? Jonathan Allen
9/24/2004 10:27:44 PM
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.

--
Jonathan Allen


[quoted text, click to view]

Re: Protect my class Libraries, can I? Rakesh Rajan
9/27/2004 11:44:32 PM
Hi Cablito,

Have a look at "Licensing Components and Controls" in MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconlicensingcomponentscontrols.asp

HTH,
- Rakesh Rajan

[quoted text, click to view]

AddThis Social Bookmark Button