Dll To Dll Security in NET

  • Thread starter Thread starter Imran Masud
  • Start date Start date
I

Imran Masud

Hi Guys,
I am doing a research on DLL to DLL security. But so far I am not able
to achieve it. I read articles about Signing the Assemblies, but that
has not answered my question.
Is it possible in .NET framework to achieve Dll to Dll Security.

Goal to achieve
My First DLL is called ABC.DLL
It should only be used by DEF.DLL. No other project or dll should be
able to use this specific dll.
 
Hi Imran,
My First DLL is called ABC.DLL
It should only be used by DEF.DLL. No other project or dll should be
able to use this specific dll.

Maybe a strange question, but why are you then making a seperate DLL and is
it not in the same project as DEF and in the same DLL?

Just curious.

Cor
 
Imran,

You could make a link demand for a strong name identity permission. This
gives you the ability to export methods in assemblies that are only callable
from your other assemblies. For instance, you could decorate the public
methods of your ABC.DLL assembly with the attribute below.

[StrongNameIdentityPermission( SecurityAction.LinkDemand,
PublicKey ="<your public
key in hex>")]
public void ABCMethod1()

The tool secutil.exe (part of the .NET Framework SDK) can be used to get the
hex string format of a public key. secutil /? will bring up the help for
the tool.

To achieve fully what you describe, you could include name and/or version
information.

[StrongNameIdentityPermission( SecurityAction.LinkDemand,
PublicKey ="<your public
key in hex>"),
Name="DEF"]
public void ABCMethod1()

Two things to note. First, when using such specific identities, the
assembly in which ABCMethod1 is declared may not be able to call the method
itself. Of course your ABCMethod1 can be a public wrapper around another
internal method which can be called from within the declaring assembly.

Second, a link demand is weaker than a full demand in that, among other
things, only the immediate caller of the method is checked. If you want all
callers on the stack to be checked, make a full demand.

The book .NET Framework Security by LaMacchia, et. al., describes this and
other techniques for implementing a secure assembly. I think this book is a
great reference.

Hope this helps.
 
Back
Top