Assembly Security

E

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
 
M

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
 
R

Richard Grimes [MVP]

Mattias said:
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
 

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

Top