public KeyGenerator(ISymmetricEncryptionProvider symmetricEncryptionProvider, IAsymmetricEncryptionProvider asymmetricEncryptionProvider, IHashingProvider hashingProvider) { this.symmetricEncryptionProvider = symmetricEncryptionProvider; this.asymmetricEncryptionProvider = asymmetricEncryptionProvider; this.hashingProvider = hashingProvider; }
object dictLock = new object(); //Объект для блокировки многопоточной записи в словари public AuthenticationProvider(IServiceProvider provider, IHashingProvider hasher) { Services = provider; Hasher = hasher; Tokens = new Dictionary <string, int>(); Expiration = new Dictionary <string, DateTime>(); }
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 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 AdministrationController(IRepository <User> userRepository, IAuthenticationProvider authenticationProvider, IRepository <Role> roleRepository, IHashingProvider hashingProvider) { UserRepository = userRepository; AuthenticationProvider = authenticationProvider; RoleRepository = roleRepository; HashingProvider = hashingProvider; }
public SqlCredentialValidator( SqlCredentialValidatorSettings settings, IHashingProvider hashingProvider) { _settings = settings; _hashingProvider = hashingProvider; }
public ProductManagementService(IServiceProductsRepository serviceProductsRepository, IHashingProvider hashingProvider, IActivationLogRepoistory activationLogRepoistory) { _serviceProductsRepository = serviceProductsRepository; _hashingProvider = hashingProvider; _activationLogRepoistory = activationLogRepoistory; }
public AuthController(IAuthenticationProvider authenticationProvider, IRepository <User> userRepository, IHashingProvider hashingProvider, IRepository <Role> roleRepository) { AuthenticationProvider = authenticationProvider; UserRepository = userRepository; HashingProvider = hashingProvider; RoleRepository = roleRepository; }
private static async Task SetupAsync() { var letterTemplate = new Letter("", "TestRabbitServiceQueue", null, new LetterMetadata()); var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().SetMinimumLevel(LogLevel)); _logger = loggerFactory.CreateLogger <ConsumerDataflow <WorkState> >(); _hashingProvider = new Argon2ID_HashingProvider(); var hashKey = await _hashingProvider.GetHashKeyAsync("passwordforencryption", "saltforencryption", 32).ConfigureAwait(false); _metricsProvider = new NullMetricsProvider(); _encryptionProvider = new AesGcmEncryptionProvider(hashKey); _compressionProvider = new LZ4PickleProvider(); _serializationProvider = new Utf8JsonProvider(); _rabbitService = new RabbitService( "Config.json", _serializationProvider, _encryptionProvider, _compressionProvider, loggerFactory); await _rabbitService .Topologer .CreateQueueAsync("TestRabbitServiceQueue") .ConfigureAwait(false); }
public RegisterAccount(IHashingProvider hashingProvider, IEncryptionProvider encryptionProvider, IAccountService accountService) { _hashingProvider = hashingProvider; _encryptionProvider = encryptionProvider; _accountService = accountService; }
public KeyGenerator(ISymmetricEncryptionProvider symmetricEncryptionProvider, IAsymmetricEncryptionProvider asymmetricEncryptionProvider, IHashingProvider hashingProvider, IHardwareFingerprintService fingerprintService) { this.symmetricEncryptionProvider = symmetricEncryptionProvider; this.asymmetricEncryptionProvider = asymmetricEncryptionProvider; this.hashingProvider = hashingProvider; _fingerprintService = fingerprintService; }
public AuthService(ISecurityTokenProvider tokenService, IHashingProvider hashingProvider, IMerchantRepository merchantRepository) { _tokenProvider = tokenService; _hashingProvider = hashingProvider; _merchantRepository = merchantRepository; }
public KeyManagementService(IClientRepository clientRepository, ILicenseKeyService licenseKeyService, IActivationLogService activationLogService, IHashingProvider hashingProvider, IServiceProductsRepository serviceProductsRepository) { _clientRepository = clientRepository; _licenseKeyService = licenseKeyService; _activationLogService = activationLogService; _hashingProvider = hashingProvider; _serviceProductsRepository = serviceProductsRepository; }
public PasswordValidationService( IHashingProvider hashingProvider, ISaltStrategy saltStrategy, IPasswordRule passwordRule) { _hashProvider = hashingProvider; _saltStrategy = saltStrategy; _passwordRule = passwordRule; }
public EncryptionProvider(ILogger <EncryptionProvider> logger, IMapperProvider mapperProvider, ISwitch <string, ICryptographicCredentials> cryptographicCredentialsSwitch, ICryptographyProvider cryptographyProvider, IHashingProvider hashingProvider) { _logger = logger; _mapperProvider = mapperProvider; _cryptographicCredentialsSwitch = cryptographicCredentialsSwitch; _cryptographyProvider = cryptographyProvider; _hashingProvider = hashingProvider; }
private static void SeedData(IApplicationBuilder app, Database context, IHashingProvider hashingProvider) { var salt = hashingProvider.GenerateSalt(); var pass = hashingProvider.GenerateHash("Test", salt); context.Merchants.Add(new Merchant { Id = 3, Name = "Checkout", Username = "******", PasswordSalt = salt, PasswordHash = pass, }); context.SaveChanges(); }
public void Setup() { XorShift = new XorShift(true); Payload = XorShift.GetRandomBytes(1024); HashProvider = new Argon2ID_HashingProvider(); HashKey = HashProvider.GetHashKey(Passphrase, Salt, KeySize); EncryptionProvider = new AesGcmEncryptionProvider(HashKey); RecyclableEncryptionProvider = new RecyclableAesGcmEncryptionProvider(HashKey); //RecyclableManager.ConfigureNewStaticManagerWithDefaults(); EncryptedPayload = EncryptionProvider.Encrypt(Payload).ToArray(); }
public static async Task Main() { _hashingProvider = new Argon2IDHasher(); var hashKey = await _hashingProvider.GetHashKeyAsync("passwordforencryption", "saltforencryption", 32).ConfigureAwait(false); _encryptionProvider = new AesGcmEncryptionProvider(hashKey, _hashingProvider.Type); _compressionProvider = new GzipProvider(); _serializationProvider = new Utf8JsonProvider(StandardResolver.Default); LogHelper.LoggerFactory = LoggerFactory.Create(builder => builder.AddConsole().SetMinimumLevel(LogLevel.Information)); await Console.Out.WriteLineAsync("CookedRabbit.Core StressTest v1.00").ConfigureAwait(false); await Console.Out.WriteLineAsync("- StressTest setting everything up...").ConfigureAwait(false); var setupFailed = false; try { await SetupAsync().ConfigureAwait(false); } catch (Exception ex) { setupFailed = true; await Console.Out.WriteLineAsync($"- StressTest failed with exception {ex.Message}.").ConfigureAwait(false); } if (!setupFailed) { await Console.Out.WriteLineAsync("- StressTest starting!").ConfigureAwait(false); try { await StartStressTestAsync() .ConfigureAwait(false); } catch (Exception ex) { await Console.Out.WriteLineAsync($"- StressTest failed with exception {ex.Message}.").ConfigureAwait(false); } } await Console.Out.WriteLineAsync($"- Press any key to begin shutdown.").ConfigureAwait(false); Console.ReadKey(); await ShutdownAsync(); await Console.Out.WriteLineAsync($"- Press any key to close.").ConfigureAwait(false); Console.ReadKey(); }
public void Setup() { XorShift = new XorShift(true); Payload1 = XorShift.GetRandomBytes(1024); Payload2 = XorShift.GetRandomBytes(2048); Payload3 = XorShift.GetRandomBytes(4096); Payload4 = XorShift.GetRandomBytes(8192); HashProvider = new Argon2ID_HashingProvider(); HashKey = HashProvider.GetHashKey(Passphrase, Salt, KeySize); EncryptionProvider = new BouncyAesGcmEncryptionProvider(HashKey); EncryptedPayload1 = EncryptionProvider.Encrypt(Payload1).ToArray(); EncryptedPayload2 = EncryptionProvider.Encrypt(Payload2).ToArray(); EncryptedPayload3 = EncryptionProvider.Encrypt(Payload3).ToArray(); EncryptedPayload4 = EncryptionProvider.Encrypt(Payload4).ToArray(); }
/// <summary> /// Override constructor to instantiate the Licensing Manager and /// point it to an object that it's the running executable. /// </summary> /// <remarks> /// This constructor is useful when running an application and calling /// Scutex via a CCW (COM Callable Wrapper) and the executing assembly /// (i.e. Access) does not contain the security attribute. /// </remarks> /// <param name="instance"> /// Reference to an object were the required attributes can be located /// </param> public LicensingManager(object instance) { this.instance = instance; Bootstrapper.Configure(); InterfaceInteraction = new TrialInterfaceInteraction(); hashingProvider = ObjectLocator.GetInstance<IHashingProvider>(); encodingService = ObjectLocator.GetInstance<IEncodingService>(); licenseManagerService = ObjectLocator.GetInstance<ILicenseManagerService>(); _clientLicenseService = ObjectLocator.GetInstance<IClientLicenseService>(); _comBypassProvider = ObjectLocator.GetInstance<IComBypassProvider>(); _registerService = ObjectLocator.GetInstance<IRegisterService>(); SetCriticalVerificationData(); VerifyLicensingAssembly(); }
public SqlCredentialValidatorIntegrationTests() { _sqlCredentialValidatorSettings = new SqlCredentialValidatorSettings { ConnectionString = ConfigurationManager.ConnectionStrings["TestDatabase"].ConnectionString, QueryTimeout = TimeSpan.Parse(ConfigurationManager.AppSettings["QueryTimeout"]) }; _hashingProvider = new Sha256HashingProvider(); _sqlCredentialValidator = new SqlCredentialValidator(_sqlCredentialValidatorSettings, _hashingProvider); _sqlUserRepositorySettings = new SqlUserRepositorySettings { ConnectionString = ConfigurationManager.ConnectionStrings["TestDatabase"].ConnectionString, QueryTimeout = TimeSpan.Parse(ConfigurationManager.AppSettings["QueryTimeout"]) }; _userRepository = new SqlUserRepository(_sqlUserRepositorySettings); }
/// <summary> /// Инициализирует базу данных /// </summary> /// <param name="users">репозиторий пользователей</param> /// <param name="roles">репозиторий ролей</param> /// <param name="provider">сервис вычислений хэша</param> /// <param name="logger">логгер</param> public static void Seed(IRepository <User> users, IRepository <Role> roles, IHashingProvider provider, ILogger logger) { logger.LogInformation("Database seeder started"); if (!(users.GetAll().Any() || roles.GetAll().Any())) { using (var hasher = System.Security.Cryptography.SHA1.Create()) { User Admin = new User { FirstName = "Администратор", SecondName = "Администратор", ThirdName = "Администратор", Username = "******", PasswordHash = provider.Hash("admin") }; Role administrator = new Role { Name = "Администратор" }; Role user = new Role { Name = "Пользователь" }; Admin.Roles.Add(administrator); Admin.Roles.Add(user); administrator.Users.Add(Admin); user.Users.Add(Admin); users.Add(Admin).Wait(); } logger.LogInformation("Database seeded"); } else { logger.LogInformation("Database is already seeded. Skipping this part"); } }
private void PrintAttribute() { IHashingProvider hashingProvider = ObjectLocator.GetInstance <IHashingProvider>(); IEncodingService encodingService = ObjectLocator.GetInstance <IEncodingService>(); string dllCheckHash = encodingService.Encode(hashingProvider.HashFile(Directory.GetCurrentDirectory() + "\\lib\\WaveTech.Scutex.Licensing.dll")); string publicKey = encodingService.Encode(UIContext.License.KeyPair.PublicKey); if (rdoCodeTypeCSharp.IsChecked.HasValue && rdoCodeTypeCSharp.IsChecked.Value) { txtAttribute.Text = string.Format("[assembly: License(\"{0}\",\"{1}\")]", publicKey, dllCheckHash); } else { txtAttribute.Text = string.Format("<Assembly: License(\"{0}\",\"{1}\")>", publicKey, dllCheckHash); } txtParam1.Text = publicKey; txtParam2.Text = dllCheckHash; }
private async Task <RabbitService> SetupAsync() { _hashingProvider = new Argon2IDHasher(); var hashKey = await _hashingProvider.GetHashKeyAsync("passwordforencryption", "saltforencryption", 32).ConfigureAwait(false); _encryptionProvider = new AesGcmEncryptionProvider(hashKey, _hashingProvider.Type); _compressionProvider = new GzipProvider(); _serializationProvider = new Utf8JsonProvider(StandardResolver.Default); var letterTemplate = new Letter("", "TestRabbitServiceQueue", null, new LetterMetadata()); var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().SetMinimumLevel(Program.LogLevel)); _logger = loggerFactory.CreateLogger <ConsumerPipelineMicroservice>(); var rabbitService = new RabbitService( "Config.json", _serializationProvider, _encryptionProvider, _compressionProvider, loggerFactory); await rabbitService .Topologer .CreateQueueAsync("TestRabbitServiceQueue") .ConfigureAwait(false); for (var i = 0L; i < _targetCount; i++) { var letter = letterTemplate.Clone(); letter.Body = JsonSerializer.SerializeToUtf8Bytes(new Message { StringMessage = $"Sensitive ReceivedLetter {i}", MessageId = i }); letter.LetterId = (ulong)i; await rabbitService .Publisher .PublishAsync(letter, true, true) .ConfigureAwait(false); } return(rabbitService); }
public static async Task Main() { _hashingProvider = new Argon2IDHasher(); var hashKey = await _hashingProvider.GetHashKeyAsync("passwordforencryption", "saltforencryption", 32).ConfigureAwait(false); _encryptionProvider = new AesGcmEncryptionProvider(hashKey, _hashingProvider.Type); _compressionProvider = new GzipProvider(); _serializationProvider = new Utf8JsonProvider(StandardResolver.Default); _rabbitService = new RabbitService( "Config.json", _serializationProvider, _encryptionProvider, _compressionProvider, null); await RunSimpleClientWithEncryptionAsync() .ConfigureAwait(false); await RunDataExecutionEngineAsync() .ConfigureAwait(false); }
public RabbitFixture() { CompressionProvider = new GzipProvider(); HashingProvider = new Argon2ID_HashingProvider(); HashKey = HashingProvider.GetHashKey(Passphrase, Salt, 32); EncryptionProvider = new AesGcmEncryptionProvider(HashKey); SerializationProvider = new Utf8JsonProvider(); Options = JsonFileReader.ReadFileAsync <RabbitOptions>("RabbitMQ\\TestConfig.json").GetAwaiter().GetResult(); RabbitService = new RabbitService( Options, SerializationProvider, EncryptionProvider, CompressionProvider, LoggerFactory .Create( builder => builder.AddConsole().SetMinimumLevel(LogLevel.Information))); ChannelPool = RabbitService.ChannelPool; Topologer = RabbitService.Topologer; Publisher = RabbitService.Publisher; }
private static async Task SetupAsync() { var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().SetMinimumLevel(LogLevel)); _hashingProvider = new Argon2IDHasher(); var hashKey = await _hashingProvider.GetHashKeyAsync("passwordforencryption", "saltforencryption", 32).ConfigureAwait(false); _encryptionProvider = new AesGcmEncryptionProvider(hashKey, _hashingProvider.Type); _compressionProvider = new LZ4PickleProvider(); _serializationProvider = new Utf8JsonProvider(); _rabbitService = new RabbitService( "Config.json", _serializationProvider, _encryptionProvider, _compressionProvider, loggerFactory); await _rabbitService .Topologer .CreateQueueAsync("TestRabbitServiceQueue") .ConfigureAwait(false); }
private void btnGetCCWFile_Click(object sender, RoutedEventArgs e) { SaveFileDialog dialog = new SaveFileDialog(); dialog.FileName = "ScutexLicensingCCW.dll"; dialog.DefaultExt = ".dll"; dialog.Filter = "DLL Files (.dll)|*.dll"; dialog.ShowDialog(); if (!String.IsNullOrEmpty(dialog.FileName)) { string assemblyPath = Directory.GetCurrentDirectory() + "\\lib\\WaveTech.Scutex.Licensing.dll"; IHashingProvider hashingProvider = ObjectLocator.GetInstance <IHashingProvider>(); IEncodingService encodingService = ObjectLocator.GetInstance <IEncodingService>(); string dllCheckHash = encodingService.Encode(hashingProvider.HashFile(assemblyPath)); string publicKey = encodingService.Encode(UIContext.License.KeyPair.PublicKey); IComApiWrappingService comApiWrappingService = ObjectLocator.GetInstance <IComApiWrappingService>(); comApiWrappingService.CreateComWrapper(dialog.FileName, assemblyPath, publicKey, dllCheckHash); } }
private static void Demo(object sender, ExecutedRoutedEventArgs e) { if (UIContext.License != null) { DemoHostHelper helper = new DemoHostHelper(); helper.CleanPreviousHost(); string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); path = path.Replace("file:\\", ""); ClientLicense cl = new ClientLicense(UIContext.License); IClientLicenseService clientLicenseService = ObjectLocator.GetInstance <IClientLicenseService>(); clientLicenseService.SaveClientLicense(cl, path + @"\sxu.dll"); IHashingProvider hashingProvider = ObjectLocator.GetInstance <IHashingProvider>(); IEncodingService encodingService = ObjectLocator.GetInstance <IEncodingService>(); string dllCheckHash = encodingService.Encode(hashingProvider.HashFile(Directory.GetCurrentDirectory() + "\\lib\\WaveTech.Scutex.Licensing.dll")); string publicKey = encodingService.Encode(UIContext.License.KeyPair.PublicKey); try { File.Copy(Directory.GetCurrentDirectory() + "\\lib\\WaveTech.Scutex.Licensing.dll", Directory.GetCurrentDirectory() + "\\WaveTech.Scutex.Licensing.dll"); } catch { } helper.CreateAssembly(publicKey, dllCheckHash); helper.ExecuteAssembly(); helper = null; } else { MessageBox.Show("You must have an open licensing project to view the demo trial form."); } }
/// <summary> /// Override constructor to instantiate the Licensing Manager and /// set options for its use. /// </summary> /// <remarks> /// This constructor is useful when calling Scutex from an instance /// where there is no running application or objects that can be /// used to run a attribute check. For example a .Net Component or /// Control. /// </remarks> /// <param name="instance"> /// Reference to an object were the required attributes can be located /// </param> /// <param name="options"> /// Options to override the default Licensing Manager behavior /// </param> public LicensingManager(object instance, LicensingManagerOptions options) { if (options != null) { _options = options; _killOnError = _options.KillOnError; } this.instance = instance; Bootstrapper.Configure(); InterfaceInteraction = new TrialInterfaceInteraction(); hashingProvider = ObjectLocator.GetInstance <IHashingProvider>(); encodingService = ObjectLocator.GetInstance <IEncodingService>(); licenseManagerService = ObjectLocator.GetInstance <ILicenseManagerService>(); _clientLicenseService = ObjectLocator.GetInstance <IClientLicenseService>(); _comBypassProvider = ObjectLocator.GetInstance <IComBypassProvider>(); _registerService = ObjectLocator.GetInstance <IRegisterService>(); SetCriticalVerificationData(); VerifyLicensingAssembly(); }
public FormAuthProvider(IAdminRepository adminRepository, IHashingProvider hashingProvider) { _repository = adminRepository; _hashingProvider = hashingProvider; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Database context, IHashingProvider hashingProvider) { if (env.IsDevelopment()) { SeedData(app, context, hashingProvider); app.UseDeveloperExceptionPage(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Payment Gateway V1"); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseMiddleware <JwtMiddleware>(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public HardwareFingerprintService(IWmiDataProvider wmiDataProvider, IHashingProvider hashingProvider) { _wmiDataProvider = wmiDataProvider; _hashingProvider = hashingProvider; }
public void WireUp() { provider = new HashingProvider(); }
public KeyService(ILicenseKeyRepository licenseKeyRepoistory, IHashingProvider hashingProvider) { _licenseKeyRepoistory = licenseKeyRepoistory; _hashingProvider = hashingProvider; }
public ActivationLogService(IActivationLogRepoistory activationLogRepository, IHashingProvider hashingProvider) { _activationLogRepository = activationLogRepository; _hashingProvider = hashingProvider; }
public ComBypass(IHashingProvider hashingProvider) { _hashingProvider = hashingProvider; }
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]); }