Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The license signature and data does not match. #11

Open
dhineshmuthuvel opened this issue Jan 5, 2020 · 7 comments
Open

The license signature and data does not match. #11

dhineshmuthuvel opened this issue Jan 5, 2020 · 7 comments

Comments

@dhineshmuthuvel
Copy link

Followed the steps mentioned in the readme, however getting the error in the validationfailures.ToList(). Any Idea on this ?

The license signature and data does not match. This usually happens when a license file is corrupted or has been altered.

public static bool ValidateLicense(string publicKey)
        {
            var readAllLines = File.ReadAllText(@"D:\Work Items\KiteConnect\LicensingPOC\LicensingPOC\License.lic");
            var license = License.Load(readAllLines);

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

            List<IValidationFailure> failures = validationFailures.ToList();

            return !failures.Any();
        }
@ZiTsi
Copy link

ZiTsi commented Jan 7, 2020

Are you using the
File.WriteAllText("License.lic", license.ToString(), Encoding.UTF8);
way to save the license to a file?

If so try the second one, ie:
using (var xmlWriter = System.Xml.XmlWriter.Create(filePath)) { license.Save(xmlWriter); }

@ChristophBachmann
Copy link

I had the same issue. Your solution (using seconde one with xmlWriter) resolved the issue.

@valimaties
Copy link

Mine does not work at all.
Neither the first, neither the second solution, both of them generates "Data at the root level is invalid: Line 1, position 1."

@leonkosak
Copy link

Offtopic question. Is this project still maintained?

@valimaties
Copy link

Offtopic question. Is this project still maintained?

I don't think so @leonkosak

@skst
Copy link

skst commented Mar 29, 2024

Yes, it was just upgraded to .NET 8.

@pjsgsy
Copy link

pjsgsy commented Jan 23, 2025

I just wanted to say thanks. I was suffering from the same issue. After 60 minutes of head-scratching, I found this. The solution works for me. For some reason, if you echo the XML and manually save that as a file, validation fails. Writing the file with the call produces a file that validates. Happy days :) Thanks for a great little library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants