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

InvalidSignatureValidationFailure: License signature validation error! #40

Open
pankajmcait opened this issue Feb 21, 2017 · 6 comments

Comments

@pankajmcait
Copy link

pankajmcait commented Feb 21, 2017

While validating the License, following error is coming out:

InvalidSignatureValidationFailure: License signature validation error! - The license signature and data does not match. This usually happens when a license file is corrupted or has been altered.

Using the following code for validation:
string licPath = Server.MapPath("\LicenseFiles\License.lic");
var keypath = Server.MapPath("
\LicenseFiles\public-key.txt");
string publicKey = System.IO.File.ReadAllText(keypath, System.Text.Encoding.UTF8);

        StringBuilder sb = new StringBuilder();
        using (XmlReader reader = XmlReader.Create(licPath))
        {

            License readLicence = License.Load(reader);
            var validationFailures = readLicence.Validate()
              .ExpirationDate()
                   .When(lic => lic.Type == LicenseType.Trial)
              .And()
              .Signature(publicKey)
              .AssertValidLicense().ToList();

            foreach (var failure in validationFailures)
                sb.Append(failure.GetType().Name + ": " + failure.Message + " - " + failure.HowToResolve);
        }

Can anybody suggest why is this happening?
@dnauck

@pankajmcait
Copy link
Author

Is there any update from anyone?

@qmfrederik
Copy link

Do you always get this error or just intermittently? license.Validate()>Signature(publicKey) is not thread safe, and you may get this errors if you have multiple threads entering this code at the same time.

@pankajmcait
Copy link
Author

Always there is error!!

@yolita15
Copy link

yolita15 commented Dec 13, 2017

Do not use that

using (XmlReader reader = XmlReader.Create(licPath))

just pass it as a string :

string reader = File.ReadAllText(licPath);
 License readLicence = License.Load(reader);
            var validationFailures = readLicence.Validate()
              .ExpirationDate()
                   .When(lic => lic.Type == LicenseType.Trial)
              .And()
              .Signature(publicKey)
              .AssertValidLicense().ToList();

            foreach (var failure in validationFailures)
                sb.Append(failure.GetType().Name + ": " + failure.Message + " - " + failure.HowToResolve);`

This should work.

@pankajmcait
Copy link
Author

pankajmcait commented Dec 14, 2017 via email

@nikro412956
Copy link

@pankajmcait well... did it work?

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

4 participants