Beispiel #1
0
        public ImageDisOptions(
            IStorageProvider storageProvider,
            IImageTransformProvider imageTransformProvider, 
            string path = null,
            ImageType[] allowedImageTypes = null,
            IKeyGenerator keyGenerator = null)
        {
            if (storageProvider == null)
                throw new ArgumentNullException("storageProvider");

            StorageProvider = storageProvider;

            if (imageTransformProvider == null)
                throw new ArgumentNullException("imageTransformProvider");

            ImageTransformProvider = imageTransformProvider;

            Path = string.IsNullOrWhiteSpace(path) ? "/imagedis" : path;

            AllowedImageTypes = allowedImageTypes == null || !allowedImageTypes.Any() 
                ? new[] { ImageTypes.Jpeg, ImageTypes.Png } 
                : allowedImageTypes;

            KeyGenerator = keyGenerator ?? new RandomKeyGenerator();
        }
Beispiel #2
0
        public KeyBuilder(
			IKeyGenerator keyGenerator,
			IEnumerable<IKeyTransformation> keyTransformations)
        {
            _keyGenerator = keyGenerator;
            _keyTransformations = keyTransformations.ToList();
        }
 public void Setup()
 {
     _fakeScenarioContext = A.Fake<IScenarioContext>();
     _fakeKeyGenerator = A.Fake<IKeyGenerator>();
     A.CallTo(() => _fakeKeyGenerator.GenerateKey(A<Type>.Ignored, A<MethodInfo>.Ignored)).Returns("testkey");
     _proxyInterceptor = new ProxyInterceptor(_fakeScenarioContext, _fakeKeyGenerator);
     _proxyGenerator = new ProxyGenerator();
 }
 public IncludeStorageFacts()
 {
     _mocks = new MockRepository();
     _stubKeyGen = _mocks.Stub<IKeyGenerator>();
     _storage = new StaticIncludeStorage(_stubKeyGen);
     _combination = new IncludeCombination(IncludeType.Css, new[] { "~/content/css/foo.css" }, "#foo {color:red}", Clock.UtcNow, new CssTypeElement());
     _mocks.ReplayAll();
 }
        public AudioAlarmRedisRepository(IKeyGenerator<Guid> keygenerator, IRedisClientsManager manager)
        {
            if (keygenerator == null) throw new ArgumentNullException(nameof(keygenerator));
            if (manager == null) throw new ArgumentNullException(nameof(manager));

            this.keygenerator = keygenerator;
            this.manager = manager;
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="AudioAlarmOrmRepository" /> class.
        /// </summary>
        public AudioAlarmOrmRepository(IKeyGenerator<Guid> keygenerator, IDbConnectionFactory factory)
        {
            if (keygenerator == null) throw new ArgumentNullException(nameof(keygenerator));
            if (factory == null) throw new ArgumentNullException(nameof(factory));

            this.keygenerator = keygenerator;
            DbConnectionFactory = factory;
        }
        protected EventWebServicesTests(string baseUri)
        {
            if (string.IsNullOrWhiteSpace(baseUri)) throw new ArgumentNullException(nameof(baseUri));
            if (!Uri.IsWellFormedUriString(baseUri, UriKind.RelativeOrAbsolute)) throw new FormatException("baseUri");

            var rndGenerator = new RandomGenerator();
            GuidKeyGenerator = new SequentialGuidKeyGenerator();
            var fpiKeyGenerator = new FpiKeyGenerator(
                new ContentGenerator<ApprovalStatus>(() => Pick<ApprovalStatus>.RandomItemFrom(new[]
                {
                    ApprovalStatus.Informal, 
                    ApprovalStatus.None
                })),
                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "RXJG",
                    "GOGL",
                    "MSFT",
                    "YHOO"
                })),

                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "DTD",
                    "XSL",
                    "XML",
                    "JSON"
                })), 
                
                new ContentGenerator<string>(() => rndGenerator.Phrase(10)),
                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "EN",
                    "FR",
                    "DE",
                    "ES",
                    "IT",
                    "PL",
                    "RO"
                })));

            var valuesFactory = new ValuesFactory(GuidKeyGenerator);
            var parametersFactory = new ParametersFactory(valuesFactory);
            PropertiesFactory = new PropertiesFactory(GuidKeyGenerator, valuesFactory, parametersFactory);
            AlarmFactory = new AlarmFactory(GuidKeyGenerator, PropertiesFactory, valuesFactory);

            EventFactory = new EventFactory(GuidKeyGenerator, AlarmFactory, PropertiesFactory, valuesFactory);
            CalendarFactory = new CalendarFactory(GuidKeyGenerator, fpiKeyGenerator);

            ServiceClientFactory = new ServiceClientFactory();
            ServiceClientFactory.Register(() => new JsonServiceClient(baseUri));
            ServiceClientFactory.Register(() => new JsvServiceClient(baseUri));
            ServiceClientFactory.Register(() => new XmlServiceClient(baseUri));

            TestService = new EventTestService();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CalendarOrmRepository"/> class.
        /// </summary>
        /// <param name="keygenerator">The generator for generating keys</param>
        /// <param name="eventrepository">The repository for calendar events</param>
        /// <param name="factory">The database connection factory</param>
        public CalendarOrmRepository(IKeyGenerator<Guid> keygenerator, IEventRepository eventrepository, IDbConnectionFactory factory)
        {
            if (keygenerator == null) throw new ArgumentNullException(nameof(keygenerator));
            if (eventrepository == null) throw new ArgumentNullException(nameof(eventrepository));
            if (factory == null) throw new ArgumentNullException(nameof(factory));

            this.keygenerator = keygenerator;
            this.eventrepository = eventrepository;
            this.factory = factory;
        }
Beispiel #9
0
        public CalendarFactory(
            IKeyGenerator<Guid> guidKeyGenerator, 
            IKeyGenerator<Fpi> fpiKeyGenerator)
        {
            if (guidKeyGenerator == null) throw new ArgumentNullException(nameof(guidKeyGenerator));
            if (fpiKeyGenerator == null) throw new ArgumentNullException(nameof(fpiKeyGenerator));

            this.guidKeyGenerator = guidKeyGenerator;
            this.fpiKeyGenerator = fpiKeyGenerator;
        }
Beispiel #10
0
        public AlarmFactory(IKeyGenerator<Guid> keyGenerator, IPropertiesFactory propertiesFactory, IValuesFactory valuesFactory)
        {
            if (keyGenerator == null) throw new ArgumentNullException(nameof(keyGenerator));
            if (propertiesFactory == null) throw new ArgumentNullException(nameof(propertiesFactory));

            this.keyGenerator = keyGenerator;
            this.rndGenerator = new RandomGenerator();
            this.propertiesFactory = propertiesFactory;
            this.valuesFactory = valuesFactory;
        }
        public CalendarDapperRepository(IDbConnectionFactory factory, IKeyGenerator<Guid> keygenerator, IEventRepository eventrepository)
        {
            dbconnection.ThrowIfNull("factory");
            keygenerator.ThrowIfNull("keygenerator");
            eventrepository.ThrowIfNull("eventrepository");

            this.factory = factory;
            this.keygenerator = keygenerator;
            this.eventrepository = eventrepository;
        }
        public CryptoUtility(SymmetricAlgorithm algorithm, IKeyGenerator keyGenerator)
        {
            Ensure.ArgumentNotNull(algorithm, "algorithm");
            Ensure.ArgumentNotNull(keyGenerator, "keyGenerator");

            _cryptoAlgorithm = algorithm;
            _cryptoAlgorithm.Padding = PaddingMode.ISO10126;

            _keyGenerator = keyGenerator;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="keygenerator"></param>
        /// <param name="eventrepository"></param>
        /// <param name="manager"></param>
        public CalendarRedisRepository(IKeyGenerator<Guid> keygenerator, IEventRepository eventrepository, IRedisClientsManager manager)
        {
            if (keygenerator == null) throw new ArgumentNullException(nameof(keygenerator));
            this.keygenerator = keygenerator;

            if (eventrepository == null) throw new ArgumentNullException(nameof(eventrepository));
            this.eventrepository = eventrepository;

            if (manager == null) throw new ArgumentNullException(nameof(manager));
            this.manager = manager;
        }
Beispiel #14
0
        public EventUnitTests()
        {
            keyGenerator = new SequentialGuidKeyGenerator();
            var valuesFactory = new ValuesFactory(keyGenerator);
            var parametersFactory = new ParametersFactory(valuesFactory);
            var propertiesFactory = new PropertiesFactory(keyGenerator, valuesFactory, parametersFactory);
            var alarmFactory = new AlarmFactory(keyGenerator, propertiesFactory, valuesFactory);

            factory = new EventFactory(keyGenerator, alarmFactory, propertiesFactory, valuesFactory);

            tzid = new TZID("America", "New_York");
        }
 public EventRedisRepository(
     IKeyGenerator<Guid> keygenerator,
     IAudioAlarmRepository aalarmrepository,
     IDisplayAlarmRepository dalarmrepository,
     IEmailAlarmRepository ealarmrepository,
     IRedisClientsManager manager)
 {
     this.keygenerator = keygenerator;
     this.ealarmrepository = ealarmrepository;
     this.dalarmrepository = dalarmrepository;
     this.aalarmrepository = aalarmrepository;
     this.manager = manager;
 }
        public DonutOutputCacheAttribute()
        {
            var keyBuilder = new KeyBuilder();

            _keyGenerator = new KeyGenerator(keyBuilder);
            _donutHoleFiller = new DonutHoleFiller(new EncryptingActionSettingsSerialiser(new ActionSettingsSerialiser(), new Encryptor()));
            _outputCacheManager = new OutputCacheManager(OutputCache.Instance, keyBuilder);
            _cacheSettingsManager = new CacheSettingsManager();
            _cacheHeadersHelper = new CacheHeadersHelper();

            Duration = -1;
            Location = (OutputCacheLocation)(-1);
        }
Beispiel #17
0
        public static List<VEVENT> GetNextOccurences(this IList<VEVENT> vevents, IKeyGenerator<Guid> keyGenerator, uint window = 6)
        {
            if (vevents.NullOrEmpty()) return vevents.ToList();

            var first = vevents.First();
            var last = vevents.Last();

            var copy = new VEVENT(first)
            {
                Start = last.Start,
                End = last.End
            };

            return copy.GenerateOccurrences(keyGenerator, window);
        }
        protected DonutOutputCacheAttribute(
            IKeyGenerator keyGenerator, IReadWriteOutputCacheManager outputCacheManager,
            IDonutHoleFiller donutHoleFiller, ICacheSettingsManager cacheSettingsManager, ICacheHeadersHelper cacheHeadersHelper
        )
        {
            KeyGenerator = keyGenerator;
            OutputCacheManager = outputCacheManager;
            DonutHoleFiller = donutHoleFiller;
            CacheSettingsManager = cacheSettingsManager;
            CacheHeadersHelper = cacheHeadersHelper;

            Duration = -1;
            Location = (OutputCacheLocation)(-1);
            Options = OutputCache.DefaultOptions;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DirectorySearcher" /> class.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="searchPattern">The search pattern.</param>
 /// <param name="recursive">if set to <c>true</c> [recursive].</param>
 /// <param name="pathResolver">The path resolver.</param>
 /// <param name="keyGenerator">The key generator.</param>
 /// <param name="rules">The rules.</param>
 public DirectorySearcher(
     IConfigurationProvider configurationProvider,
     IPathResolver pathResolver, 
     IKeyGenerator keyGenerator,
     IFileSystemProvider fileProvider,
     string path,
     string searchPattern,
     bool recursive, 
     params IIncludeConfigurationRule[] rules)
 {
     this.ConfigurationProvider = configurationProvider;
     this.Path = path;
     this.SearchPattern = searchPattern;
     this.Recursive = recursive;
     this.PathResolver = pathResolver;
     this.KeyGenerator = keyGenerator;
     this.Rules = rules;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="keygenerator"></param>
        /// <param name="aalarmrepository"></param>
        /// <param name="dalarmrepository"></param>
        /// <param name="ealarmrepository"></param>
        /// <param name="factory"></param>
        public EventOrmRepository(
            IKeyGenerator<Guid> keygenerator,
            IAudioAlarmRepository aalarmrepository,
            IDisplayAlarmRepository dalarmrepository,
            IEmailAlarmRepository ealarmrepository,
            IDbConnectionFactory factory)
        {
            if (keygenerator == null) throw new ArgumentNullException(nameof(keygenerator));
            if (aalarmrepository == null) throw new ArgumentNullException(nameof(aalarmrepository));
            if (dalarmrepository == null) throw new ArgumentNullException(nameof(dalarmrepository));
            if (ealarmrepository == null) throw new ArgumentNullException(nameof(ealarmrepository));
            if (factory == null) throw new ArgumentNullException(nameof(factory));

            this.keygenerator = keygenerator;
            this.aalarmrepository = aalarmrepository;
            this.dalarmrepository = dalarmrepository;
            this.ealarmrepository = ealarmrepository;
            this.factory = factory;
        }
Beispiel #21
0
        public ValuesFactory(IKeyGenerator<Guid> keyGenerator)
        {
            if (keyGenerator == null) throw new ArgumentNullException(nameof(keyGenerator));
            this.keyGenerator = keyGenerator;

            rndGenerator = new RandomGenerator();
            dateTimeGenerator = new SequentialGenerator<DateTime>
            {
                IncrementDateBy = Pick<IncrementDate>.RandomItemFrom(new[]
                {
                    IncrementDate.Second,
                    IncrementDate.Minute,
                    IncrementDate.Hour,
                    IncrementDate.Day,
                    IncrementDate.Month,
                    IncrementDate.Year,
                }),
                Direction = GeneratorDirection.Ascending
            };
        }
 /// <summary>
 /// Creates a new instance of the RijndaelEncryptionProvider class
 /// </summary>
 /// <param name="keyGenerator">Key generator to use to generate the key and iv</param>
 public RijndaelEncryptionProvider(IKeyGenerator keyGenerator)
 {
     this.key = keyGenerator.GetBytes(32);
     this.iv = keyGenerator.GetBytes(16);
 }
 public _CacheDecoratorCommandHandler(ICacheProvider cacheProvider, IKeyGenerator keyGenerator, ICommandHandler <T> decoratee)
 {
     this.cacheProvider = cacheProvider;
     _keyGenerator      = keyGenerator;
     _decoratee         = decoratee;
 }
Beispiel #24
0
        public static IEnumerable <SerializationInfo> GetSerializationMembers(Type type, IKeyGenerator keyGen)
        {
            EnsureMetaDataInitialized(type);

            var data = MetaData[type];

            return(data.ImplicitMembers
                   .Select(sm => new SerializationInfo(sm, new TomlKey(keyGen.GetKey(sm.MemberInfo))))
                   .Concat(data.ExplicitMembers));
        }
 /// <summary>
 /// Creates a new instance of the DefaultHmacProvider type
 /// </summary>
 /// <param name="keyGenerator">Key generator to use to generate the key</param>
 public DefaultHmacProvider(IKeyGenerator keyGenerator)
 {
     this.key = keyGenerator.GetBytes(PreferredKeySize);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DataServiceController{TKey, TAggregateRoot}"/> class.
 /// </summary>
 /// <param name="repositoryContext">The repository context that is used for initializing the data service controller.</param>
 /// <param name="keyGenerator">The key generator which is used for generating the aggregate root key.
 /// If the persistence mechanism will generate the key automatically, for example, in SQL Server databases, an auto increment
 /// value is used for the key column, the <see cref="NullKeyGenerator{TKey}"/> can be used for this parameter.
 /// </param>
 public DataServiceController(IRepositoryContext repositoryContext, IKeyGenerator <TKey, TAggregateRoot> keyGenerator)
     : this(repositoryContext, keyGenerator, new IronyQueryConditionParser(), new IronySortSpecificationParser())
 {
 }
 public ProxyInterceptor(IScenarioContext scenarioContext, IKeyGenerator keyGenerator)
 {
     _scenarioContext = scenarioContext;
     _keyGenerator = keyGenerator;
 }
        /// <summary>
        /// Construct a sink that saves logs to the specified storage account.
        /// </summary>
        /// <param name="storageAccount">The Cloud Storage Account to use to insert the log entries to.</param>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="storageTableName">Table name that log entries will be written to. Note: Optional, setting this may impact performance</param>
        /// <param name="additionalRowKeyPostfix">Additional postfix string that will be appended to row keys</param>
        /// <param name="keyGenerator">Generates the PartitionKey and the RowKey</param>
        /// <param name="propertyColumns">Specific properties to be written to columns. By default, all properties will be written to columns.</param>
        public AzureTableStorageWithPropertiesSink(CloudStorageAccount storageAccount, IFormatProvider formatProvider, string storageTableName = null, string additionalRowKeyPostfix = null, IKeyGenerator keyGenerator = null, string[] propertyColumns = null)
        {
            var tableClient = storageAccount.CreateCloudTableClient();

            if (string.IsNullOrEmpty(storageTableName))
            {
                storageTableName = "LogEventEntity";
            }

            _table = tableClient.GetTableReference(storageTableName);
            _table.CreateIfNotExistsAsync().SyncContextSafeWait(_waitTimeoutMilliseconds);

            _formatProvider          = formatProvider;
            _additionalRowKeyPostfix = additionalRowKeyPostfix;
            _propertyColumns         = propertyColumns;
            _keyGenerator            = keyGenerator ?? new PropertiesKeyGenerator();
        }
Beispiel #29
0
        /// <summary>
        ///     Construct a sink that saves logs to the specified storage account.
        /// </summary>
        /// <param name="storageAccount">The Cloud Storage Account to use to insert the log entries to.</param>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="batchSizeLimit"></param>
        /// <param name="period"></param>
        /// <param name="storageTableName">
        ///     Table name that log entries will be written to. Note: Optional, setting this may impact
        ///     performance
        /// </param>
        /// <param name="keyGenerator">generator used for partition keys and row keys</param>
        public AzureBatchingTableStorageSink(CloudStorageAccount storageAccount, IFormatProvider formatProvider,
                                             int batchSizeLimit, TimeSpan period, string storageTableName = null, IKeyGenerator keyGenerator = null)
            : base(batchSizeLimit, period)
        {
            if (batchSizeLimit < 1 || batchSizeLimit > 100)
            {
                throw new ArgumentException("batchSizeLimit must be between 1 and 100 for Azure Table Storage");
            }

            _formatProvider = formatProvider;
            _keyGenerator   = keyGenerator ?? new DefaultKeyGenerator();
            var tableClient = storageAccount.CreateCloudTableClient();

            if (string.IsNullOrEmpty(storageTableName))
            {
                storageTableName = typeof(LogEventEntity).Name;
            }

            _table = tableClient.GetTableReference(storageTableName);
            _table.CreateIfNotExistsAsync().SyncContextSafeWait();
        }
 public EntityIdProvider(IKeyGenerator <TEntity, TKey> keyGenerator) : this(keyGenerator, new AttributeKeyBinder <TEntity, TKey>())
 {
 }
 public EntityIdProvider(IKeyGenerator <TEntity, TKey> keyGenerator, IEntityKeyBinder <TEntity, TKey> keyBinder)
 {
     _getKey    = keyGenerator;
     _keyBinder = keyBinder;
 }
 /// <summary>
 /// Returns the unique value as a int value.
 /// </summary>
 /// <param name="generator">An object that produces new key values.</param>
 /// <returns>Unique int value.</returns>
 public static int GetKeyAsInt(this IKeyGenerator <long> generator)
 {
     return((int)generator.GetKey());
 }
        private void SetLicenseCapibilites()
        {
            LicenseCapability capibilities = null;

            if (UIContext.License != null)
            {
                switch (UIContext.License.KeyGeneratorType)
                {
                case KeyGeneratorTypes.StaticSmall:
                    IKeyGenerator keygen = ObjectLocator.GetInstance <IKeyGenerator>(InstanceNames.SmallKeyGenerator);
                    capibilities = keygen.GetLicenseCapability();
                    break;

                default:
                    break;
                }
            }

            if (capibilities != null)
            {
                if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.SingleUser))
                {
                    cboSingleUser.IsEnabled = true;
                }
                else
                {
                    cboSingleUser.IsChecked = false;
                    cboSingleUser.IsEnabled = false;
                }

                if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.MultiUser))
                {
                    cboMultiUser.IsEnabled = true;
                }
                else
                {
                    cboMultiUser.IsChecked = false;
                    cboMultiUser.IsEnabled = false;
                }

                if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.HardwareLock))
                {
                    cboHardwareLock.IsEnabled      = true;
                    cboHardwareLockLocal.IsEnabled = true;
                }
                else
                {
                    cboHardwareLock.IsChecked = false;
                    cboHardwareLock.IsEnabled = false;

                    cboHardwareLockLocal.IsChecked = false;
                    cboHardwareLockLocal.IsEnabled = false;
                }

                if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.Unlimited))
                {
                    cboUnlimited.IsEnabled = true;
                }
                else
                {
                    cboUnlimited.IsChecked = false;
                    cboUnlimited.IsEnabled = false;
                }

                if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.Enterprise))
                {
                    cboEnterprise.IsEnabled = true;
                }
                else
                {
                    cboEnterprise.IsChecked = false;
                    cboEnterprise.IsEnabled = false;
                }
            }
        }
Beispiel #34
0
 public SqlSecretStore(IServiceProvider serviceProvider, IKeyGenerator keyGenerator, ILogger <SqlSecretStore> logger)
 {
     _serviceProvider = serviceProvider;
     _keyGenerator    = keyGenerator;
     _logger          = logger;
 }
 public EncryptionSettings(IKeyGenerator keyGenerator)
 {
     SymmetricAlgorithm     = Encryptor.PreferredSymmetricAlgorithm;
     KeyDerivationAlgorithm = Encryptor.PreferredKeyDerivationAlgorithm;
     KeyGenerator           = keyGenerator;
 }
Beispiel #36
0
 /// <summary>
 /// Registers an <see cref="IKeyGenerator{TKey, TAggregateRoot}"/> instance by using its instance to the service registration.
 /// </summary>
 /// <typeparam name="TKey">The type of the aggregate root key.</typeparam>
 /// <typeparam name="TAggregateRoot">The type of the aggregate root.</typeparam>
 /// <param name="keyGenerator">The key generator instance to be registered.</param>
 /// <returns>The current instance of <see cref="DataServiceConfigurationOptions"/> class.</returns>
 public DataServiceConfigurationOptions RegisterKeyGenerator <TKey, TAggregateRoot>(IKeyGenerator <TKey, TAggregateRoot> keyGenerator)
     where TKey : IEquatable <TKey>
     where TAggregateRoot : class, IAggregateRoot <TKey> => this.RegisterService(keyGenerator, ServiceLifetime.Singleton);
        /// <summary>
        /// Processes the section.
        /// </summary>
        /// <param name="sectconfigurationSectionion">The section.</param>
        /// <param name="configuration">The configuration.</param>
        /// <returns></returns>
        protected virtual KeyValuePair<string, IConfiguration>? ProcessSection(
            DirectorySearcherArgs args,
            IKeyGenerator keyGenerator,
            IIncludeConfigurationRule[] rules)
        {
            // check if we have a valid configuration section
            var bootstrapConfiguration = args.ConfigurationSection as IBootstrapConfiguration;
            if (bootstrapConfiguration != null)
            {
                string key = bootstrapConfiguration.Key;
                if (!string.IsNullOrWhiteSpace(key))
                {
                    // loop over the rules. if a rule fails, return null.
                    foreach (var rule in rules)
                    {
                        if (!rule.Execute(args))
                            return null;
                    }
                    return new KeyValuePair<string, IConfiguration>(key, args.Configuration);
                }
                // todo: tracewarning
            }

            // let the rules determine what the kick out condition is. For that reason we should allow any config section and use the key generator.
            return null;
        }
Beispiel #38
0
        => keyGenerator.NotNull(nameof(keyGenerator)).GenerateKey(64, token);     // 512

        /// <summary>
        /// 获取 1024 位密钥。
        /// </summary>
        /// <param name="keyGenerator">给定的 <see cref="IKeyGenerator"/>。</param>
        /// <param name="token">给定的 <see cref="SecurityToken"/>(可选;默认使用选项配置)。</param>
        /// <returns>返回字节数组。</returns>
        public static byte[] GetKey1024(this IKeyGenerator keyGenerator, SecurityToken token = null)
        => keyGenerator.NotNull(nameof(keyGenerator)).GenerateKey(128, token);     // 1024
 /// <summary>
 /// Initializes a new instance of the <see cref="DataServiceController{TKey, TAggregateRoot}"/> class.
 /// </summary>
 /// <param name="repositoryContext">The repository context that is used by the current
 /// <see cref="DataServiceController{TKey, TAggregateRoot}"/> for managing the object lifecycle.</param>
 /// <param name="keyGenerator">The <see cref="IKeyGenerator{TKey, TAggregateRoot}"/> instance
 /// which generates the aggregate root key for the specified aggregate root type.</param>
 protected DataServiceController(IRepositoryContext repositoryContext, IKeyGenerator <TKey, TAggregateRoot> keyGenerator)
 {
     this.repositoryContext = repositoryContext;
     this.repository        = repositoryContext.GetRepository <TKey, TAggregateRoot>();
     this.keyGenerator      = keyGenerator;
 }
Beispiel #40
0
 public IActionResult GenerateKeys([FromServices] IKeyGenerator keyGenerator)
 {
     return(Ok(keyGenerator.Generate()));
 }
Beispiel #41
0
 /// <summary>
 /// 获取 AES 密钥。
 /// </summary>
 /// <param name="keyGenerator">给定的 <see cref="IKeyGenerator"/>。</param>
 /// <param name="token">给定的 <see cref="SecurityToken"/>(可选;默认使用选项配置)。</param>
 /// <returns>返回字节数组。</returns>
 public static byte[] GetAesKey(this IKeyGenerator keyGenerator, SecurityToken token = null)
 => keyGenerator.GetKey256(token);
Beispiel #42
0
 /// <summary>
 /// 获取 TripleDES 密钥。
 /// </summary>
 /// <param name="keyGenerator">给定的 <see cref="IKeyGenerator"/>。</param>
 /// <param name="token">给定的 <see cref="SecurityToken"/>(可选;默认使用选项配置)。</param>
 /// <returns>返回字节数组。</returns>
 public static byte[] GetTripleDesKey(this IKeyGenerator keyGenerator, SecurityToken token = null)
 => keyGenerator.GetKey192(token);
 public void TestSetup()
 {
     _keygen = new KeyGenerator();
 }
Beispiel #44
0
 /// <summary>
 /// 获取 HMAC MD5 密钥。
 /// </summary>
 /// <param name="keyGenerator">给定的 <see cref="IKeyGenerator"/>。</param>
 /// <param name="token">给定的 <see cref="SecurityToken"/>(可选;默认使用选项配置)。</param>
 /// <returns>返回字节数组。</returns>
 public static byte[] GetHmacMd5Key(this IKeyGenerator keyGenerator, SecurityToken token = null)
 => keyGenerator.GetKey512(token);
Beispiel #45
0
 protected void key_builder(IKeyGenerator keyGenerator, params IKeyTransformation[] keyTransformation)
 {
     keyBuilder = new KeyBuilder(keyGenerator, keyTransformation);
 }
Beispiel #46
0
 /// <summary>
 /// 获取 HMAC SHA512 密钥。
 /// </summary>
 /// <param name="keyGenerator">给定的 <see cref="IKeyGenerator"/>。</param>
 /// <param name="token">给定的 <see cref="SecurityToken"/>(可选;默认使用选项配置)。</param>
 /// <returns>返回字节数组。</returns>
 public static byte[] GetHmacSha512Key(this IKeyGenerator keyGenerator, SecurityToken token = null)
 => keyGenerator.GetKey1024(token);
 public KeyGeneratorFacts()
 {
     _keygen = new KeyGenerator();
 }
Beispiel #48
0
 public CryptoService(IKeyGenerator keyGenerator, Func <IKeyGenerator, IHmacProvider> hmacProvider)
 {
     _keyGenerator = keyGenerator;
     _hmacProvider = hmacProvider(_keyGenerator);
 }
Beispiel #49
0
        public static void SetKeyGenerator(IKeyGenerator keyGenerator)
        {
            keyGenerator.Ensure("keyGenerator");

            _keyGenerator = keyGenerator;
        }
Beispiel #50
0
 public void Initialize(IKeyGenerator keyGenerator)
 {
     this.KeyGeneratorInstance = keyGenerator;
 }
 public StaticIncludeStorage(IKeyGenerator keyGen)
 {
     _keyGen = keyGen;
 }
Beispiel #52
0
 /// <summary>
 /// Creates a new instance of the AesEncryptionProvider class
 /// </summary>
 /// <param name="keyGenerator">Key generator to use to generate the key and iv</param>
 public AesEncryptionProvider(IKeyGenerator keyGenerator)
 {
     this.key = keyGenerator.GetBytes(32);
     this.iv  = keyGenerator.GetBytes(16);
 }
Beispiel #53
0
 public FolderBO(IFolderDAO dao, IMappingEngine mapper, IKeyGenerator keyGenerator)
 {
     FolderDAO = dao;
     Mapper = mapper;
     KeyGenerator = keyGenerator;
 }
 public RsaKeyGeneratorTests()
 {
     _keyGenerator = new RsaKeyGenerator();
 }
Beispiel #55
0
 internal CryptographyCommandhandler(IKeyGenerator keyGenerator)
 {
     _keyGenerator = keyGenerator;
 }
Beispiel #56
0
 public MessageQueueRepository(IMessageDbContext context, IKeyGenerator keyGenerator)
 {
     this.context      = context;
     this.keyGenerator = keyGenerator;
 }
Beispiel #57
0
        => keyGenerator.NotNull(nameof(keyGenerator)).GenerateKey(128, token);     // 1024

        /// <summary>
        /// 获取 2048 位密钥。
        /// </summary>
        /// <param name="keyGenerator">给定的 <see cref="IKeyGenerator"/>。</param>
        /// <param name="token">给定的 <see cref="SecurityToken"/>(可选;默认使用选项配置)。</param>
        /// <returns>返回字节数组。</returns>
        public static byte[] GetKey2048(this IKeyGenerator keyGenerator, SecurityToken token = null)
        => keyGenerator.NotNull(nameof(keyGenerator)).GenerateKey(256, token);     // 2048
 public StringGenerator(IKeyGenerator <int> intGenerator)
 {
     _intGenerator = intGenerator;
 }