Standard.Licensing icon indicating copy to clipboard operation
Standard.Licensing copied to clipboard

How to Right Valid lic file

Open dellos opened this issue 11 months ago • 1 comments

var validationFailures = license.Validate()  
                                .ExpirationDate(systemDateTime: DateTime.Now)  
                                .When(lic => lic.Type == LicenseType.Trial)  
                                .And()  
                                .Signature(publicKey)  
                                .AssertValidLicense();

if somehow cracker knows I was using this lib then he watches the real created .lic file to know what fields my app was checking. then he creates a .lic file using the same lib with his private key and passphrase and the same field structure. then I thought this fake .lic file would be accept in my app cause the above code would validate the fake one too!!!

Is there some misunderstood or something I need to change to make it right using the Lib?

dellos avatar Dec 02 '24 05:12 dellos

@dellos - you are signing with your private key, but you validate the signature with your public key. They are a pair. So, even if someone uses the same library with the same fields, etc, to generate a license file, unless they also had your private key to sign with, their license file will fail when you validate the signature with your public key.

jshergal avatar Jan 21 '25 22:01 jshergal

I can only advise not to spend so much time worrying about licensing. If someone wants to bypass it, they will. For example patching the Public Key with dnlib at runtime, it's that simple.

KieranFoot avatar Aug 16 '25 12:08 KieranFoot

I can only advise not to spend so much time worrying about licensing. If someone wants to bypass it, they will. For example patching the Public Key with dnlib at runtime, it's that simple.

You are right. I was trying to invert dll to c# code the test app, and it makes sense that no matter what we do, there will be a if ( valid) {run the app } in the code. If they can find out that point, they can patch it. So the way we're doing it here is just for the normal end user.

dellos avatar Aug 18 '25 08:08 dellos