I am developing a. NET application. One of my DLLs manages all the security (data encryption, license management, etc).

I was wondering if someone could somehow substitute this DLL file with one of its own, in order to trick my Application.

Is there any kind of digital signature undertaken by the compiler or would I need to hard-type hash values of the referenced DLL in my main file to verify integrity ?


I have found this interesting article which explains how to make sure the DLL referenced has not been changed for another : at compilation a build manifest is generated. This manifest includes the hash value of all files included in the build at that time. The manifest is then signed. If the signature can be verified then the manifest and its hash values can be trusted and compared with the hash of the actual files. If it is a match, we can trust the entire assembly. This check is done each time the application is run, not only at setup.

So now my question can be rephrased to address the security issue from the other side: how can I prevent someone from using the DLL provided in an assembly? Let's assume an assembly is made of 2 files:

  1. A manages the user interface, and
  2. B contains the core of the intellectual property associated with the software.

How can I prevent someone from developing their own A which would just need to make a reference to B and use it like any DLL ?

  • 3
    Google is your friend: Signing of .NET Assemblies
    – Doc Brown
    Feb 20, 2019 at 23:17
  • 2
    The problem with Google is you need to know what is the name of what you are looking for. So assemblies signature it is!
    – Ama
    Feb 20, 2019 at 23:27
  • 2
    To answer your question, after you've provided your key to VS to sign your dll, there is no more work required on your part codewise. The thing is code signing is an all or nothing preposition. So if you're using open source libraries (unless the project offers signed dlls). You will have to build and sign them yourself. Feb 21, 2019 at 3:36
  • 3
    Glad I could help, you are welcome. Note your update is a different question than the one you asked first. The answer to it was given on Stackoverflow as well.
    – Doc Brown
    Feb 21, 2019 at 6:31
  • 2
    @PatrickHughes 2 reasons: (1) One DLL is re-used through several Assemblies, so having it as a separate file makes maintenance easier, (2) I develop a VSTO (Add-in for Excel) and the way this is done is Excel points to a Main DLL (it's kind of by design )
    – Ama
    Feb 22, 2019 at 12:10

1 Answer 1


Appears that the .NET security stategy (strong names and assembly signature schemes) is to protect the User from malicious software (when the user runs a signed assembly, they can be sure it was published by Mr X and not Mr Y), but not to protect the Software Company from having its DLLs used by a third party.

More information here, where I also happen to suggest a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.