Beispiel #1
0
        public async Task <bool> CheckCurrentLicenseAsync()
        {
            var licenseEntity = await _licenseStorage.GetAsync();

            if (licenseEntity == null)
            {
                return(false);
            }

            License license;

            try
            {
                license = License.FromBase64(licenseEntity.Base64);
            }
            catch
            {
                license = null;
            }

            if (license == null)
            {
                return(false);
            }

            if (DateTimeOffset.UtcNow > license.ValidUntilDate)
            {
                return(false);
            }

            return(license.Type == LicenseType.Trial ||
                   _licenseChecker.CheckSignature(license));
        }
        private bool CheckLicenseSignature(License license)
        {
            if (license.Type != LicenseType.Trial)
            {
                return(_licenseChecker.CheckSignature(license));
            }

            return(true);
        }