Cryptolens/cryptolens-dotnet

License Genuineness cannot be verified on environments without colon separator in time-format

martinweiss92 opened this issue · 4 comments

hi @artemlos, could you please take a look at the following line?

https://github.com/Cryptolens/cryptolens-dotnet/blob/master/Cryptolens.Licensing/Core/HelperExtensionMethods.cs#L59

i have noticed problems in your HasValidSignature function, because the IsLicenceseKeyGenuine check unfortunately does not always convert all DateTime objects into the culture neutral format: yyyy-MM-ddTHH:mm:ss.

i was able to reproduce the problem with the .net frameworks DateTime.ToString(format) function by simply adjusting the long time format on my windows 10 environment.

simply configure a region format like 'Danish (Greenland)', or just change the colon separator for hours and minutes like this:
image

a culture invariant conversion should actually be possible by using the ToString(format, provider) overload.

it would be great if you could provide a new version of the 'Cryptolens.Licensing' nuget package soon in which this problem is fixed.
i think that quite a lot of region formats should be affected.

best regards,
~martin from coolOrange

@martinweiss92
Hi Martin, thanks for letting us know! The constant ConfigValues.DEFAULT_TIME_REPSENTATION (

public static readonly string DEFAULT_TIME_REPSENTATION = "yyyy-MM-ddTHH:mm:ss";
) should be the same for all users so it seems that there could be an issue somewhere else in the signature verification code where this representation is not used.

We will look into it and get back soon.

Thanks again!

hi @artemlos,

actually your constant DEFAULT_TIME_REPSENTATION should be used for the signature verification (see my issue description for yyyy-MM-ddTHH:mm:ss and IsLicenceseKeyGenuine).

but thanks anyway for looking at the problem promptly!

thank you!

@martinweiss92, thank you!

It should now be fixed. The solution was to add CultureInfo.InvariantCulture as follows: 57f9d0b.

When using the latest version (available on NuGet), I did not get this issue with Danish (Greenland) culture.

Please let me know if you still experience this issue.

@artemlos, thank you too!

great to hear that the proposed solution was implemented so quickly for the IsLicenceseKeyGenuine function.

yes no problem, if further problems occur i will contact you immediately.