Click here to Skip to main content
14,028,463 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I need advice on how to design a licensing system when I am importing DLL files using the MEF. So, my program would run and on startup would begin to load all the DLL's from a specific map into the program. First of, I want to make sure that the program would only load DLL's that are allowed by me, so let's say the original set of DLL's.
Other people can buy a license to also make these DLL's. So there must also be a way to validate this.

What I have tried:

I have absolutely 0 experience on the licensing topic. I have read a lot of articles but nothing really seems to fit my problem.
Posted
Updated 22-Apr-17 12:12pm

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Understand than ANY approach you take is vulnerable to reverse engineering. The most you can hope for is to make it difficult but not impossible for someone to break your licensing mechanism.

The best way to enforce licensing is to run everything on a server - forcing the clients to connect to a server that your control.

Back to your proposal - some low effort things you can do to validate a DLL is check the assembly attributes.
var self = System.Reflection.Assembly.GetExecutingAssembly();

var assembly = System.Reflection.Assembly.LoadFile("suspect.dll");

Assembly Class (System.Reflection)[^]

Next level up would be a hash function on the DLL file. Compare the hash result to a list of known good hash values - eg. an "allowed" list of DLLs.

Better still, use code signing as a way to authenticate each DLL. You application stores a public key which can be used to validate the signature of the DLL.

You must protect the private key by not sharing it with anyone.

None of these are foolproof. It's all about raising the difficulty level where it is actually cheaper to pay for a license than spend the time to crack it.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190419.4 | Last Updated 22 Apr 2017
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100