Open pankajmcait opened 7 years ago
Is there any update from anyone?
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.
Always there is error!!
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.
okay, i will try this code and let you know...
On Wed, Dec 13, 2017 at 7:23 PM, Yoanna notifications@github.com wrote:
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.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dnauck/Portable.Licensing/issues/40#issuecomment-351397089, or mute the thread https://github.com/notifications/unsubscribe-auth/AYt8_GmxuJiJ9pbWRnAE3tOqKOL4hrboks5s_9bcgaJpZM4MG4ea .
--
ThanksPankaj Jain+91 9871844292
@pankajmcait well... did it work?
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);
Can anybody suggest why is this happening? @dnauck