How to control access the assemblies?

  • Thread starter Thread starter RA
  • Start date Start date
R

RA

Hi

I have a csharp assemblies that communicates between themselves. They are
not installed in the GAC. How can I limit access between the assemblies to
be only for those assemblies and not some other unknown assembly?

Thanks,
Ronen
 
Add a link demand to your classes that requires a specific public key for
assemblies that link to your class. Relace PublicKey with the public key
that you're requiring.
[StrongNameIdentityPermission(SecurityAction.LinkDemand, PublicKey = "...")]
public class MeMeOnlyMe
{
}
 
The only problem with adding a public key and using this method is that
anybody can use that public key and can extract it from you assembly.
Normally if you want to do something like this only one assembly is
required, because two assemblies that can only communicate with each other
might as well be one assembly.

But you can always create a custom authentication scheme between the same
assemblies or set up a secure connection using sockets. Or do many things.
If you could post more about what you are trying to accomplish we might be
able to help you more.


Mickey Williams said:
Add a link demand to your classes that requires a specific public key for
assemblies that link to your class. Relace PublicKey with the public key
that you're requiring.
[StrongNameIdentityPermission(SecurityAction.LinkDemand, PublicKey = "...")]
public class MeMeOnlyMe
{
}

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com



RA said:
Hi

I have a csharp assemblies that communicates between themselves. They are
not installed in the GAC. How can I limit access between the assemblies to
be only for those assemblies and not some other unknown assembly?

Thanks,
Ronen
 
Nick said:
The only problem with adding a public key and using this method is that
anybody can use that public key and can extract it from you assembly.

Huh? Sure anybody can extract the public key, but they can only sign an
assembly with it if they also have the private portion - and presumably
you've kept *that* private.
Normally if you want to do something like this only one assembly is
required, because two assemblies that can only communicate with each other
might as well be one assembly.

Assembly factoring is orthogonal to the identity of the person(s) creating
the assembly. My current app has 5 developers and 20+ assemblies.
 
Back
Top