Home All Groups Group Topic Archive Search About
Author
31 Jan 2006 9:01 PM
Evian Spring
Is it possible to create an assembly (Namespace A) and set it so only
certain assembly can load it and invoke methods on it.

For example, only Namespace B and Namespace C would be able to invoke
Namespace A because of this security setting.

Is this possible?  if yes I would really appreciate it you could let me
know if possible or not and how?

Many thanks!
Evian

Author
31 Jan 2006 9:17 PM
Mattias Sjögren
>Is it possible to create an assembly (Namespace A) and set it so only
>certain assembly can load it and invoke methods on it.
>
>For example, only Namespace B and Namespace C would be able to invoke
>Namespace A because of this security setting.
>
>Is this possible?

Yes (sort of), I suggest reading about Code Access Security in general
and link demands and classes like StrongNameIdentityPermission in
particular in the docs.

You can do this based on assembly identity, but namespaces has nothing
to do with it.

microsoft.public.dotnet.security is a great group for further
questions about this.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
5 Feb 2006 9:55 PM
Richard Grimes [MVP]
Mattias Sjögren wrote:
>> Is it possible to create an assembly (Namespace A) and set it so only
>> certain assembly can load it and invoke methods on it.
>>
>> For example, only Namespace B and Namespace C would be able to invoke
>> Namespace A because of this security setting.
>>
>> Is this possible?
>
> Yes (sort of), I suggest reading about Code Access Security in general
> and link demands and classes like StrongNameIdentityPermission in
> particular in the docs.

The 'sort of' bit is important. The identity permissions have no effect
for trusted code in .NET 2.0:

http://blogs.msdn.com/eugene_bobukh/archive/2005/05/06/415217.aspx

So if your code gets full trust then you cannot use identity permissions
to perform the action the OP requires in .NET 2.0

However, in .NET 2.0 you can use friend assemblies. In this case an
assembly indicates the assemblies that can call its internal types. This
is not a security issue, because any code can use reflection to call an
internal type in another assembly.

Richard

AddThis Social Bookmark Button