public void An_not_expired_non_OEM_license_is_valid()
        {
            var rsa = new RSACryptoServiceProvider();
            var licenseGenerator = new LicenseGenerator(rsa.ToXmlString(true));
            var licenseValues = new Dictionary<string, string>();

            var license = licenseGenerator.Generate("Foo", Guid.NewGuid(), DateTime.Today.AddDays(1), licenseValues, LicenseType.Subscription);
            var licenseValidator = new StringLicenseValidator(rsa.ToXmlString(false), license)
            {
                DisableFloatingLicenses = true,
                SubscriptionEndpoint = "http://uberprof.com/Subscriptions.svc"
            };
            licenseValidator.AssertValidLicense();
        }
        public void An_expired_non_OEM_license_is_invalid()
        {
            var rsa = new RSACryptoServiceProvider();
            var licenseGenerator = new LicenseGenerator(rsa.ToXmlString(true));
            var licenseValues = new Dictionary<string, string>();

            var license = licenseGenerator.Generate("Foo", Guid.NewGuid(), new DateTime(2000, 1, 1), licenseValues, LicenseType.Subscription);
            var licenseValidator = new StringLicenseValidator(rsa.ToXmlString(false), license)
            {
                DisableFloatingLicenses = true,
                SubscriptionEndpoint = "http://uberprof.com/Subscriptions.svc"
            };
            Assert.Throws<LicenseExpiredException>(() => licenseValidator.AssertValidLicense());
        }
Exemple #3
0
        private void btnIssueLicense_Click(object sender, EventArgs e)
        {
            if (openDialog.ShowDialog() == DialogResult.OK)
            {

                var privateKey = File.ReadAllText(openDialog.FileName);

                var id = Guid.NewGuid();
                var generator = new LicenseGenerator(private_key);

                string OS = txtOS.Text;
                string CPU = txtCPUInfo.Text;
                string BaseBoard = txtMotherboardInfo.Text;
                string Bios = txtOS.Text;

                LicenseType.

                // generate the license
                var license = generator.Generate(OS, CPU,BaseBoard, Bios);

                Console.WriteLine(license);

            }
        }
Exemple #4
0
 private static string GenerateLicense(Guid id, LicenseValidator validator, IDictionary<string, string> attributes)
 {
     var generator = new LicenseGenerator(LicenseServerPrivateKey);
     return generator.Generate(validator.Name, id, SystemTime.UtcNow.AddMinutes(45), attributes, LicenseType.Floating);
 }
 private static string GenerateLicense(Guid id, LicenseValidator validator)
 {
     var generator = new LicenseGenerator(LicenseServerPrivateKey);
     return generator.Generate(validator.Name, id, DateTime.Now.AddMinutes(45), LicenseType.Floating);
 }
Exemple #6
0
        private static string GenerateLicense(Guid id, LicenseValidator validator, IDictionary <string, string> attributes)
        {
            var generator = new LicenseGenerator(LicenseServerPrivateKey);

            return(generator.Generate(validator.Name, id, DateTime.UtcNow.AddMinutes(45), attributes, LicenseType.Floating));
        }
Exemple #7
0
        private static string GenerateLicense(Guid id, LicenseValidator validator)
        {
            var generator = new LicenseGenerator(LicenseServerPrivateKey);

            return(generator.Generate(validator.Name, id, DateTime.Now.AddMinutes(45), LicenseType.Floating));
        }