Exemplo n.º 1
0
 public KeyGenerator(ISymmetricEncryptionProvider symmetricEncryptionProvider,
                     IAsymmetricEncryptionProvider asymmetricEncryptionProvider, IHashingProvider hashingProvider)
 {
     this.symmetricEncryptionProvider  = symmetricEncryptionProvider;
     this.asymmetricEncryptionProvider = asymmetricEncryptionProvider;
     this.hashingProvider = hashingProvider;
 }
Exemplo n.º 2
0
		public KeyGenerator(ISymmetricEncryptionProvider symmetricEncryptionProvider,
			IAsymmetricEncryptionProvider asymmetricEncryptionProvider, IHashingProvider hashingProvider)
		{
			this.symmetricEncryptionProvider = symmetricEncryptionProvider;
			this.asymmetricEncryptionProvider = asymmetricEncryptionProvider;
			this.hashingProvider = hashingProvider;
		}
Exemplo n.º 3
0
 public ServiceStatusProvider(ISymmetricEncryptionProvider symmetricEncryptionProvider,
                              IObjectSerializationProvider objectSerializationProvider, IAsymmetricEncryptionProvider asymmetricEncryptionProvider)
 {
     _symmetricEncryptionProvider  = symmetricEncryptionProvider;
     _objectSerializationProvider  = objectSerializationProvider;
     _asymmetricEncryptionProvider = asymmetricEncryptionProvider;
 }
            public void Before_each_test()
            {
                asymmetricEncryptionProvider = new AsymmetricEncryptionProvider();
                symmetricEncryptionProvider  = new SymmetricEncryptionProvider();
                hashingProvider = new HashingProvider();

                smallKeyGenerator = new KeyGenerator(symmetricEncryptionProvider, asymmetricEncryptionProvider, hashingProvider);

                license           = new ClientLicense();
                generationOptions = new LicenseGenerationOptions();

                license.UniqueId          = Guid.NewGuid();
                license.Product           = new Product();
                license.Product.Name      = "My Great Uber Cool Product, with new juice!";
                license.Product.ProductId = 1;

                license.LicenseSets = new NotifyList <LicenseSet>();
                license.LicenseSets.Add(new LicenseSet());

                license.LicenseSets.First().SupportedLicenseTypes  = LicenseKeyTypeFlag.SingleUser;
                license.LicenseSets.First().SupportedLicenseTypes |= LicenseKeyTypeFlag.Enterprise;
                license.LicenseSets.First().SupportedLicenseTypes |= LicenseKeyTypeFlag.Unlimited;

                generationOptions.LicenseKeyType = LicenseKeyTypes.Enterprise;

                string productHash = hashingProvider.Checksum32(license.GetLicenseProductIdentifier()).ToString("X");

                placeholders           = smallKeyGenerator.CreateLicensePlaceholders(license, generationOptions);
                placeholdersInTemplate = KeyGenerator.FindAllPlaceholdersInTemplate(KeyGenerator.licenseKeyTemplate, placeholders);

                key = smallKeyGenerator.GenerateLicenseKey("TEST", license, generationOptions);
            }
Exemplo n.º 5
0
        public ServiceStatusProvider(ISymmetricEncryptionProvider symmetricEncryptionProvider,
			IObjectSerializationProvider objectSerializationProvider, IAsymmetricEncryptionProvider asymmetricEncryptionProvider)
        {
            _symmetricEncryptionProvider = symmetricEncryptionProvider;
            _objectSerializationProvider = objectSerializationProvider;
            _asymmetricEncryptionProvider = asymmetricEncryptionProvider;
        }
Exemplo n.º 6
0
		public ReportingProvider(ISymmetricEncryptionProvider symmetricEncryptionProvider,
			IObjectSerializationProvider objectSerializationProvider, IAsymmetricEncryptionProvider asymmetricEncryptionProvider)
		{
			_symmetricEncryptionProvider = symmetricEncryptionProvider;
			_objectSerializationProvider = objectSerializationProvider;
			_asymmetricEncryptionProvider = asymmetricEncryptionProvider;
		}
 public LicenseActiviationProvider(IAsymmetricEncryptionProvider asymmetricEncryptionProvider, ISymmetricEncryptionProvider symmetricEncryptionProvider,
                                   IObjectSerializationProvider objectSerializationProvider)
 {
     _asymmetricEncryptionProvider = asymmetricEncryptionProvider;
     _objectSerializationProvider  = objectSerializationProvider;
     _symmetricEncryptionProvider  = symmetricEncryptionProvider;
 }
			public void Before_each_test()
			{
				asymmetricEncryptionProvider = new AsymmetricEncryptionProvider();
				symmetricEncryptionProvider = new SymmetricEncryptionProvider();
				hashingProvider = new HashingProvider();

				smallKeyGenerator = new KeyGenerator(symmetricEncryptionProvider, asymmetricEncryptionProvider, hashingProvider);

				license = new ClientLicense();
				generationOptions = new LicenseGenerationOptions();

				license.UniqueId = Guid.NewGuid();
				license.Product = new Product();
				license.Product.Name = "My Great Uber Cool Product, with new juice!";
				license.Product.ProductId = 1;

				license.LicenseSets = new NotifyList<LicenseSet>();
				license.LicenseSets.Add(new LicenseSet());

				license.LicenseSets.First().SupportedLicenseTypes = LicenseKeyTypeFlag.SingleUser;
				license.LicenseSets.First().SupportedLicenseTypes |= LicenseKeyTypeFlag.Enterprise;
				license.LicenseSets.First().SupportedLicenseTypes |= LicenseKeyTypeFlag.Unlimited;

				generationOptions.LicenseKeyType = LicenseKeyTypes.Enterprise;

				string productHash = hashingProvider.Checksum32(license.GetLicenseProductIdentifier()).ToString("X");

				placeholders = smallKeyGenerator.CreateLicensePlaceholders(license, generationOptions);
				placeholdersInTemplate = KeyGenerator.FindAllPlaceholdersInTemplate(KeyGenerator.licenseKeyTemplate, placeholders);

				key = smallKeyGenerator.GenerateLicenseKey("TEST", license, generationOptions);
			}
		public LicenseActiviationProvider(IAsymmetricEncryptionProvider asymmetricEncryptionProvider, ISymmetricEncryptionProvider symmetricEncryptionProvider,
			IObjectSerializationProvider objectSerializationProvider)
		{
			_asymmetricEncryptionProvider = asymmetricEncryptionProvider;
			_objectSerializationProvider = objectSerializationProvider;
			_symmetricEncryptionProvider = symmetricEncryptionProvider;
		}
Exemplo n.º 10
0
 public ReportingProvider(ISymmetricEncryptionProvider symmetricEncryptionProvider,
                          IObjectSerializationProvider objectSerializationProvider, IAsymmetricEncryptionProvider asymmetricEncryptionProvider)
 {
     _symmetricEncryptionProvider  = symmetricEncryptionProvider;
     _objectSerializationProvider  = objectSerializationProvider;
     _asymmetricEncryptionProvider = asymmetricEncryptionProvider;
 }
Exemplo n.º 11
0
		public KeyGenerator(ISymmetricEncryptionProvider symmetricEncryptionProvider,
			IAsymmetricEncryptionProvider asymmetricEncryptionProvider, IHashingProvider hashingProvider, IHardwareFingerprintService fingerprintService)
		{
			this.symmetricEncryptionProvider = symmetricEncryptionProvider;
			this.asymmetricEncryptionProvider = asymmetricEncryptionProvider;
			this.hashingProvider = hashingProvider;
			_fingerprintService = fingerprintService;
		}
Exemplo n.º 12
0
        public SystemRepository(IObjectSerializationProvider objectSerializationProvider, ISymmetricEncryptionProvider encryptionProvider)
        {
            _objectSerializationProvider = objectSerializationProvider;
            _encryptionProvider = encryptionProvider;

            _path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            _path = _path.Replace("file:\\", "");
        }
Exemplo n.º 13
0
 public KeyGenerator(ISymmetricEncryptionProvider symmetricEncryptionProvider,
                     IAsymmetricEncryptionProvider asymmetricEncryptionProvider, IHashingProvider hashingProvider, IHardwareFingerprintService fingerprintService)
 {
     this.symmetricEncryptionProvider  = symmetricEncryptionProvider;
     this.asymmetricEncryptionProvider = asymmetricEncryptionProvider;
     this.hashingProvider = hashingProvider;
     _fingerprintService  = fingerprintService;
 }
Exemplo n.º 14
0
        public SystemRepository(IObjectSerializationProvider objectSerializationProvider, ISymmetricEncryptionProvider encryptionProvider)
        {
            _objectSerializationProvider = objectSerializationProvider;
            _encryptionProvider          = encryptionProvider;

            _path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            _path = _path.Replace("file:\\", "");
        }
Exemplo n.º 15
0
 public ControlService(ISymmetricEncryptionProvider symmetricEncryptionProvider, IKeyPairService keyPairService,
                       IPackingService packingService, IMasterService masterService, IObjectSerializationProvider objectSerializationProvider,
                       IAsymmetricEncryptionProvider asymmetricEncryptionProvider)
 {
     _symmetricEncryptionProvider = symmetricEncryptionProvider;
     _packingService = packingService;
     _masterService  = masterService;
     _keyPairService = keyPairService;
     _objectSerializationProvider  = objectSerializationProvider;
     _asymmetricEncryptionProvider = asymmetricEncryptionProvider;
 }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            ReadTables();

            //TestSqlTableNameFinder();

            Console.WriteLine("Press enter to exit.");
            Console.ReadLine();

            IObjectSerializationProvider objectSerializationProvider = ObjectLocator.GetInstance <IObjectSerializationProvider>();
            ISymmetricEncryptionProvider symmetricEncryptionProvider = ObjectLocator.GetInstance <ISymmetricEncryptionProvider>();
            IDatabaseProjectRepository   databaseProjectRepository   = ObjectLocator.GetInstance <IDatabaseProjectRepository>();
        }
Exemplo n.º 17
0
        public DatabaseProjectRepository(IObjectSerializationProvider objectSerializationProvider, ISymmetricEncryptionProvider encryptionProvider)
        {
            this.objectSerializationProvider = objectSerializationProvider;
            this.encryptionProvider          = encryptionProvider;

            encryptionInfo               = new EncryptionInfo();
            encryptionInfo.KeySize       = 256;
            encryptionInfo.HashAlgorithm = Resources.EncryptionHashValue;
            encryptionInfo.PassPhrase    = Resources.EncryptionPassPhrase;
            encryptionInfo.SaltValue     = Resources.EncryptionSaltValue;
            encryptionInfo.Iterations    = 5;
            encryptionInfo.InitVector    = Resources.EncryptionInitVector;
        }
        public DatabaseProjectRepository(IObjectSerializationProvider objectSerializationProvider, ISymmetricEncryptionProvider encryptionProvider)
        {
            this.objectSerializationProvider = objectSerializationProvider;
            this.encryptionProvider = encryptionProvider;

            encryptionInfo = new EncryptionInfo();
            encryptionInfo.KeySize = 256;
            encryptionInfo.HashAlgorithm = Resources.EncryptionHashValue;
            encryptionInfo.PassPhrase = Resources.EncryptionPassPhrase;
            encryptionInfo.SaltValue = Resources.EncryptionSaltValue;
            encryptionInfo.Iterations = 5;
            encryptionInfo.InitVector = Resources.EncryptionInitVector;
        }
Exemplo n.º 19
0
        public ClientLicenseRepository(IObjectSerializationProvider objectSerializationProvider, ISymmetricEncryptionProvider encryptionProvider)
        {
            this.objectSerializationProvider = objectSerializationProvider;
            this.encryptionProvider          = encryptionProvider;

            path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            path = path.Replace("file:\\", "");

            encryptionInfo               = new EncryptionInfo();
            encryptionInfo.KeySize       = 256;
            encryptionInfo.HashAlgorithm = Resources.EncryptionHashValue;
            encryptionInfo.PassPhrase    = Resources.EncryptionPassPhrase;
            encryptionInfo.SaltValue     = Resources.EncryptionSaltValue;
            encryptionInfo.Iterations    = 5;
            encryptionInfo.InitVector    = Resources.EncryptionInitVector;
        }
Exemplo n.º 20
0
		public ClientLicenseRepository(IObjectSerializationProvider objectSerializationProvider, ISymmetricEncryptionProvider encryptionProvider)
		{
			this.objectSerializationProvider = objectSerializationProvider;
			this.encryptionProvider = encryptionProvider;

			path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
			path = path.Replace("file:\\", "");

			encryptionInfo = new EncryptionInfo();
			encryptionInfo.KeySize = 256;
			encryptionInfo.HashAlgorithm = Resources.EncryptionHashValue;
			encryptionInfo.PassPhrase = Resources.EncryptionPassPhrase;
			encryptionInfo.SaltValue = Resources.EncryptionSaltValue;
			encryptionInfo.Iterations = 5;
			encryptionInfo.InitVector = Resources.EncryptionInitVector;
		}
            public void Before_each_test()
            {
                asymmetricEncryptionProvider = new AsymmetricEncryptionProvider();
                symmetricEncryptionProvider  = new SymmetricEncryptionProvider();
                hashingProvider = new HashingProvider();

                var mock = new Mock <IHardwareFingerprintService>();

                mock.Setup(foo => foo.GetHardwareFingerprint(FingerprintTypes.Default)).Returns("JustATestFingerprint1050");

                _hardwareFingerprintService = new HardwareFingerprintService(new WmiDataProvider(), hashingProvider);

                largeKeyGenerator = new KeyGenerator(symmetricEncryptionProvider, asymmetricEncryptionProvider, hashingProvider, mock.Object);

                license           = new ClientLicense();
                generationOptions = new List <LicenseGenerationOptions>();
                generationOptions.Add(new LicenseGenerationOptions());
                generationOptions.Add(new LicenseGenerationOptions());
                generationOptions.Add(new LicenseGenerationOptions());
                generationOptions.Add(new LicenseGenerationOptions());
                generationOptions.Add(new LicenseGenerationOptions());
                generationOptions.Add(new LicenseGenerationOptions());

                license.UniqueId          = Guid.NewGuid();
                license.Product           = new Product();
                license.Product.Name      = "My Great Uber Cool Product, with new juice!";
                license.Product.ProductId = 1;

                license.LicenseSets = new NotifyList <LicenseSet>();
                license.LicenseSets.Add(new LicenseSet());
                license.LicenseSets.Add(new LicenseSet());
                license.LicenseSets.Add(new LicenseSet());
                license.LicenseSets.Add(new LicenseSet());
                license.LicenseSets.Add(new LicenseSet());

                license.LicenseSets[0].LicenseSetId           = 1;
                license.LicenseSets[0].Name                   = "Standard Edition";
                license.LicenseSets[0].MaxUsers               = 5;
                license.LicenseSets[0].SupportedLicenseTypes  = LicenseKeyTypeFlag.SingleUser;
                license.LicenseSets[0].SupportedLicenseTypes |= LicenseKeyTypeFlag.MultiUser;
                license.LicenseSets[0].SupportedLicenseTypes |= LicenseKeyTypeFlag.Unlimited;

                license.LicenseSets[1].LicenseSetId           = 2;
                license.LicenseSets[1].Name                   = "Professional Edition";
                license.LicenseSets[1].MaxUsers               = 5;
                license.LicenseSets[1].SupportedLicenseTypes  = LicenseKeyTypeFlag.SingleUser;
                license.LicenseSets[1].SupportedLicenseTypes |= LicenseKeyTypeFlag.MultiUser;
                license.LicenseSets[1].SupportedLicenseTypes |= LicenseKeyTypeFlag.Unlimited;

                license.LicenseSets[2].LicenseSetId           = 3;
                license.LicenseSets[2].Name                   = "Enterprise Edition";
                license.LicenseSets[2].MaxUsers               = 5;
                license.LicenseSets[2].SupportedLicenseTypes  = LicenseKeyTypeFlag.SingleUser;
                license.LicenseSets[2].SupportedLicenseTypes |= LicenseKeyTypeFlag.MultiUser;
                license.LicenseSets[2].SupportedLicenseTypes |= LicenseKeyTypeFlag.Unlimited;
                license.LicenseSets[2].SupportedLicenseTypes |= LicenseKeyTypeFlag.Enterprise;

                license.LicenseSets[3].LicenseSetId          = 4;
                license.LicenseSets[3].Name                  = "Upgrade Edition";
                license.LicenseSets[3].MaxUsers              = 0;
                license.LicenseSets[3].IsUpgradeOnly         = true;
                license.LicenseSets[3].SupportedLicenseTypes = LicenseKeyTypeFlag.SingleUser;

                license.LicenseSets[4].LicenseSetId          = 5;
                license.LicenseSets[4].Name                  = "Hardware Edition";
                license.LicenseSets[4].MaxUsers              = 0;
                license.LicenseSets[4].IsUpgradeOnly         = false;
                license.LicenseSets[4].SupportedLicenseTypes = LicenseKeyTypeFlag.HardwareLock;

                generationOptions[0].LicenseKeyType = LicenseKeyTypes.SingleUser;
                generationOptions[0].LicenseSetId   = 1;

                generationOptions[1].LicenseKeyType = LicenseKeyTypes.Enterprise;
                generationOptions[1].LicenseSetId   = 2;

                generationOptions[2].LicenseKeyType = LicenseKeyTypes.Enterprise;
                generationOptions[2].LicenseSetId   = 3;

                generationOptions[3].LicenseKeyType = LicenseKeyTypes.Enterprise;
                generationOptions[3].LicenseSetId   = 4;

                generationOptions[4].LicenseKeyType      = LicenseKeyTypes.HardwareLock;
                generationOptions[4].HardwareFingerprint = "JustATestFingerprint1050";
                generationOptions[4].LicenseSetId        = 5;

                generationOptions[5].LicenseKeyType      = LicenseKeyTypes.HardwareLockLocal;
                generationOptions[5].HardwareFingerprint = "JustATestFingerprint1050";
                generationOptions[5].LicenseSetId        = 5;

                string productHash = hashingProvider.Checksum32(license.GetLicenseProductIdentifier()).ToString("X");

                placeholders           = largeKeyGenerator.CreateLicensePlaceholders(license, generationOptions[0]);
                placeholdersInTemplate = KeyGenerator.FindAllPlaceholdersInTemplate(KeyGenerator.licenseKeyTemplate, placeholders);

                key = largeKeyGenerator.GenerateLicenseKey("TEST", license, generationOptions[0]);
            }
			public void Before_each_test()
			{
				asymmetricEncryptionProvider = new AsymmetricEncryptionProvider();
				symmetricEncryptionProvider = new SymmetricEncryptionProvider();
				hashingProvider = new HashingProvider();

				var mock = new Mock<IHardwareFingerprintService>();
				mock.Setup(foo => foo.GetHardwareFingerprint(FingerprintTypes.Default)).Returns("JustATestFingerprint1050");

				_hardwareFingerprintService = new HardwareFingerprintService(new WmiDataProvider(), hashingProvider);

				largeKeyGenerator = new KeyGenerator(symmetricEncryptionProvider, asymmetricEncryptionProvider, hashingProvider, mock.Object);

				license = new ClientLicense();
				generationOptions = new List<LicenseGenerationOptions>();
				generationOptions.Add(new LicenseGenerationOptions());
				generationOptions.Add(new LicenseGenerationOptions());
				generationOptions.Add(new LicenseGenerationOptions());
				generationOptions.Add(new LicenseGenerationOptions());
				generationOptions.Add(new LicenseGenerationOptions());
				generationOptions.Add(new LicenseGenerationOptions());

				license.UniqueId = Guid.NewGuid();
				license.Product = new Product();
				license.Product.Name = "My Great Uber Cool Product, with new juice!";
				license.Product.ProductId = 1;

				license.LicenseSets = new NotifyList<LicenseSet>();
				license.LicenseSets.Add(new LicenseSet());
				license.LicenseSets.Add(new LicenseSet());
				license.LicenseSets.Add(new LicenseSet());
				license.LicenseSets.Add(new LicenseSet());
				license.LicenseSets.Add(new LicenseSet());

				license.LicenseSets[0].LicenseSetId = 1;
				license.LicenseSets[0].Name = "Standard Edition";
				license.LicenseSets[0].MaxUsers = 5;
				license.LicenseSets[0].SupportedLicenseTypes = LicenseKeyTypeFlag.SingleUser;
				license.LicenseSets[0].SupportedLicenseTypes |= LicenseKeyTypeFlag.MultiUser;
				license.LicenseSets[0].SupportedLicenseTypes |= LicenseKeyTypeFlag.Unlimited;

				license.LicenseSets[1].LicenseSetId = 2;
				license.LicenseSets[1].Name = "Professional Edition";
				license.LicenseSets[1].MaxUsers = 5;
				license.LicenseSets[1].SupportedLicenseTypes = LicenseKeyTypeFlag.SingleUser;
				license.LicenseSets[1].SupportedLicenseTypes |= LicenseKeyTypeFlag.MultiUser;
				license.LicenseSets[1].SupportedLicenseTypes |= LicenseKeyTypeFlag.Unlimited;

				license.LicenseSets[2].LicenseSetId = 3;
				license.LicenseSets[2].Name = "Enterprise Edition";
				license.LicenseSets[2].MaxUsers = 5;
				license.LicenseSets[2].SupportedLicenseTypes = LicenseKeyTypeFlag.SingleUser;
				license.LicenseSets[2].SupportedLicenseTypes |= LicenseKeyTypeFlag.MultiUser;
				license.LicenseSets[2].SupportedLicenseTypes |= LicenseKeyTypeFlag.Unlimited;
				license.LicenseSets[2].SupportedLicenseTypes |= LicenseKeyTypeFlag.Enterprise;

				license.LicenseSets[3].LicenseSetId = 4;
				license.LicenseSets[3].Name = "Upgrade Edition";
				license.LicenseSets[3].MaxUsers = 0;
				license.LicenseSets[3].IsUpgradeOnly = true;
				license.LicenseSets[3].SupportedLicenseTypes = LicenseKeyTypeFlag.SingleUser;

				license.LicenseSets[4].LicenseSetId = 5;
				license.LicenseSets[4].Name = "Hardware Edition";
				license.LicenseSets[4].MaxUsers = 0;
				license.LicenseSets[4].IsUpgradeOnly = false;
				license.LicenseSets[4].SupportedLicenseTypes = LicenseKeyTypeFlag.HardwareLock;

				generationOptions[0].LicenseKeyType = LicenseKeyTypes.SingleUser;
				generationOptions[0].LicenseSetId = 1;

				generationOptions[1].LicenseKeyType = LicenseKeyTypes.Enterprise;
				generationOptions[1].LicenseSetId = 2;

				generationOptions[2].LicenseKeyType = LicenseKeyTypes.Enterprise;
				generationOptions[2].LicenseSetId = 3;

				generationOptions[3].LicenseKeyType = LicenseKeyTypes.Enterprise;
				generationOptions[3].LicenseSetId = 4;

				generationOptions[4].LicenseKeyType = LicenseKeyTypes.HardwareLock;
				generationOptions[4].HardwareFingerprint = "JustATestFingerprint1050";
				generationOptions[4].LicenseSetId = 5;

				generationOptions[5].LicenseKeyType = LicenseKeyTypes.HardwareLockLocal;
				generationOptions[5].HardwareFingerprint = "JustATestFingerprint1050";
				generationOptions[5].LicenseSetId = 5;

				string productHash = hashingProvider.Checksum32(license.GetLicenseProductIdentifier()).ToString("X");

				placeholders = largeKeyGenerator.CreateLicensePlaceholders(license, generationOptions[0]);
				placeholdersInTemplate = KeyGenerator.FindAllPlaceholdersInTemplate(KeyGenerator.licenseKeyTemplate, placeholders);

				key = largeKeyGenerator.GenerateLicenseKey("TEST", license, generationOptions[0]);
			}