I am trying to make a project which will help me to implement feature based licensing in future projects. The projects in this solution are C#/WPF Projects.

So I have a Helper-Project with a class "Licensing" which contains the following function:

public bool CheckLicenseForFeatureId(int featureId) {
   // return true/false

I am adding a reference to this project and call this function on start of the project in the constructor of App.xaml

public App() {

The debug folder now looks like this:

enter image description here

My Question: Is there a security problem when using functions of a different project in order to check if a software is licensed properly?

  • It's pretty trivial to replace the DLLs if the user turns off strong name validation. Nov 19 '20 at 10:02
  • 1
    How 'secure' do you need? Nov 19 '20 at 10:02
  • 2
    If your executable is in my computer and the security boils down to an if somewhere, to bypass it, all I need to do is to find the conditional jump and flip it. And the fact that this is .NET would make that much more easier. So, don't worry about it.
    – Theraot
    Nov 19 '20 at 10:02
  • 2
    Define "better", how good is enough? Messing with a .NET assembly is easy. Putting the security checks in another assembly is about the same. If it was good enough for you when it was in the same assembly, it should be good enough for you in a different one. You can, of course, make it harder. You can try obfuscation, hash and decrypt, and so on. And I'd probably desist. But somebody with the monetary incentive probably won't. If it is in the computer of the user, and the user is determined to access it, you can only make it hard, never impossible. And that can make cloud computing attractive.
    – Theraot
    Nov 19 '20 at 10:15
  • 1
    @Updater Well, there is a difference. If I have to find, in an assembly, where to edit to bypass its security, I will have a harder job in a larger assembly. But that is no excuse to not use another project. Good obfuscation tools can merge two assemblies and then obfuscate them. If that is not available to you… You can have external source files in your project, so that your projects share them. Or use git submodules. Or make your second project a Source Code Only NuGet Package (and host it in a private Nuget server), every time you add it, it would copy the source into your project.
    – Theraot
    Nov 19 '20 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.