Standard.Licensing
Standard.Licensing copied to clipboard
The license signature and data does not match.
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();
}
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); }
I had the same issue. Your solution (using seconde one with xmlWriter) resolved the issue.
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."
Offtopic question. Is this project still maintained?
Offtopic question. Is this project still maintained?
I don't think so @leonkosak
Yes, it was just upgraded to .NET 8.