public DataMigrator( ILogger <DataMigrator <T> > logger, IKeyResolver <T> keyResolver, IGetAllQuery <T> sourceQuery, ICreateCommand <T> targetCommand, DataMigratorOptions options = null) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (keyResolver == null) { throw new ArgumentNullException(nameof(keyResolver)); } if (sourceQuery == null) { throw new ArgumentNullException(nameof(sourceQuery)); } if (targetCommand == null) { throw new ArgumentNullException(nameof(targetCommand)); } log = logger; this.keyResolver = keyResolver; this.sourceQuery = sourceQuery; this.targetCommand = targetCommand; this.options = options ?? new DataMigratorOptions(); }
public void UnBind(IKeyResolver kr) { if (kr == null) { throw new ArgumentNullException("kr"); } list.Remove(kr); }
public SubscriberFactory(IKeyResolver keyResolver, ICacheClient cacheClient, IExchangeSubscriberService subscriberService) { this.keyResolver = keyResolver; this.cacheClient = cacheClient; this.subscriberService = subscriberService; }
/// <summary> /// Initializes a new instance of the <see cref="EncryptedMessageDeserializer"/> class. /// </summary> /// <param name="deserializer">The deserializer.</param> /// <param name="keyResolver">The key resolver.</param> /// <exception cref="ArgumentNullException">deserializer or keyResolver is null</exception> public EncryptedMessageDeserializer(JsonSerializer deserializer, IKeyResolver keyResolver) : this(deserializer, () => keyResolver) { if (keyResolver == null) { throw new ArgumentNullException(nameof(keyResolver)); } }
/// <summary> /// Constructor. /// </summary> /// <param name="capacity">The maximim capacity for the cache</param> /// <param name="inner">The IKeyResolver to wrap</param> public CachingKeyResolver( int capacity, IKeyResolver inner ) { if ( inner == null ) throw new ArgumentNullException( "inner" ); _cache = new LRUCache<string, IKey>( capacity ); _inner = inner; }
public AggregateKeyResolver Add( IKeyResolver resolver ) { if ( resolver == null ) throw new ArgumentNullException( "resolver" ); _resolvers.Add( resolver ); return this; }
/// <summary> /// Constructor. /// </summary> /// <param name="capacity">The maximim capacity for the cache</param> /// <param name="inner">The IKeyResolver to wrap</param> public CachingKeyResolver(int capacity, IKeyResolver inner) { if (inner == null) { throw new ArgumentNullException("inner"); } _cache = new LRUCache <string, IKey>(capacity); _inner = inner; }
public AggregateKeyResolver Add(IKeyResolver resolver) { if (resolver == null) { throw new ArgumentNullException("resolver"); } _resolvers.Add(resolver); return(this); }
public EncryptionPolicy(IKey encryptionKey, IKeyResolver decryptionKeyResolver) { if (encryptionKey == null & decryptionKeyResolver == null) { throw new ArgumentException($"Neither {nameof(encryptionKey)} nor {nameof(decryptionKeyResolver)} has been set."); } this.cachedEncryptionKey = encryptionKey; this.encryptionPolicyOptions = new EncryptionPolicyOptions { KeyResolver = decryptionKeyResolver }; if (encryptionKey != null) { this.encryptionPolicyOptions.EncryptionKey = (token) => Task.FromResult(encryptionKey); } this.encryptionPolicyOptions.Validate(); this.semaphoreSlim = new SemaphoreSlim(1); this.defaultSettings = new JsonSerializerSettings(); }
public TableProvider(string accountName, string accountKey, string tableName, string keyId, IKeyResolver keyResolver) { var storageCredentials = new StorageCredentials(accountName, accountKey); var storageAccount = new CloudStorageAccount(storageCredentials, useHttps: true); var tableClient = storageAccount.CreateCloudTableClient(); _table = tableClient.GetTableReference(tableName); _table.CreateIfNotExists(); _requestOption = new TableRequestOptions() { EncryptionPolicy = new TableEncryptionPolicy(keyResolver.ResolveKeyAsync(keyId, CancellationToken.None).Result, null) }; _retreiveOption = new TableRequestOptions() { EncryptionPolicy = new TableEncryptionPolicy(null, keyResolver) }; }
public Interceptor(IKeyResolver keyResolver) { _keyResolver = keyResolver.Resolve; }
/// <summary> /// Initializes a new instance of the <see cref="QueueEncryptionPolicy"/> class with the specified key and resolver. /// </summary> /// <param name="key">An object of type <see cref="IKey"/> that is used to wrap/unwrap the content encryption key.</param> /// <param name="keyResolver">The key resolver used to select the correct key for decrypting existing queue messages.</param> /// <remarks>If the generated policy is to be used for encryption, users are expected to provide a key at the minimum. /// The absence of key will cause an exception to be thrown during encryption.<br/> /// If the generated policy is intended to be used for decryption, users can provide a key resolver. The client library will:<br/> /// 1. Invoke the key resolver, if specified, to get the key.<br/> /// 2. If resolver is not specified but a key is specified, the client library will match the key ID against the key and use the key.</remarks> public QueueEncryptionPolicy(IKey key, IKeyResolver keyResolver) { this.Key = key; this.KeyResolver = keyResolver; }
/// <summary> /// Encryption /// </summary> /// <param name="keyResolver">Key Resolver</param> public Encryption(IKeyResolver keyResolver) : this() { this.keyResolver = keyResolver; }
public ExchangeSubscriberService(ICacheClient cacheClient, IKeyResolver keyResolver) { this.cacheClient = cacheClient; this.keyResolver = keyResolver; }
public EnvelopeCryptoStorageEngine(CloudStorageAccount storageAccount, IKeyResolver keyResolver) { _keyResolver = keyResolver; _cloudBlobClient = storageAccount.CreateCloudBlobClient(); }
/// <summary> /// Uses the azure key vault encryption. Encryption key must be set for outgoing message /// encryption. The key resolver must be set for message decryption. /// </summary> /// <param name="configurator">The configurator.</param> /// <param name="encryptionKey">The encryption key.</param> /// <param name="keyResolver">The key resolver.</param> /// <exception cref="ArgumentNullException">configurator is null</exception> /// <exception cref="ArgumentException">encryptionKey and keyResolver are null</exception> public static void UseAzureKeyVaultEncryption(this IBusFactoryConfigurator configurator, IKey encryptionKey, IKeyResolver keyResolver) { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } if (encryptionKey == null && keyResolver == null) { throw new ArgumentException($"{nameof(encryptionKey)} or {nameof(keyResolver)} must be set."); } configurator.AddBusFactorySpecification(new KeyVaultPipeSpecification(() => encryptionKey, () => keyResolver)); }
/// <summary> /// Initializes a new instance of the <see cref="TableEncryptionPolicy"/> class with the specified key and resolver. /// </summary> /// <param name="key">An object of type <see cref="IKey"/> that is used to wrap/unwrap the content encryption key.</param> /// <param name="keyResolver">The key resolver used to select the correct key for decrypting existing table entities.</param> /// <remarks>If the generated policy is to be used for encryption, users are expected to provide a key at the minimum. /// The absence of key will cause an exception to be thrown during encryption.<br/> /// If the generated policy is intended to be used for decryption, users can provide a key resolver. The client library will:<br/> /// 1. Invoke the key resolver, if specified, to get the key.<br/> /// 2. If resolver is not specified but a key is specified, the client library will match the key ID against the key and use the key.</remarks> public TableEncryptionPolicy(IKey key, IKeyResolver keyResolver) { this.Key = key; this.KeyResolver = keyResolver; }
/// <summary> /// Encryption /// </summary> /// <param name="keyResolver">Key Resolver</param> /// <param name="logger">Logger</param> public Encryption(IKeyResolver keyResolver, ILogger logger) : this() { this.keyResolver = keyResolver; this.logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="BlobEncryptionPolicy"/> class with the specified key and resolver. /// </summary> /// <param name="key">An object of type <see cref="IKey"/> that is used to wrap/unwrap the content key during encryption.</param> /// <param name="keyResolver">The key resolver used to select the correct key for decrypting existing blobs.</param> /// <remarks>If the generated policy is to be used for encryption, users are expected to provide a key at the minimum. /// The absence of key will cause an exception to be thrown during encryption.<br/> /// If the generated policy is intended to be used for decryption, users can provide a key resolver. The client library will:<br/> /// 1. Invoke the key resolver, if specified, to get the key.<br/> /// 2. If resolver is not specified but a key is specified, the client library will match the key ID against the key and use the key.</remarks> public BlobEncryptionPolicy(IKey key, IKeyResolver keyResolver) { this.Key = key; this.KeyResolver = keyResolver; this.EncryptionMode = BlobEncryptionMode.FullBlob; }
public Modem(IKeyResolver<IDeviceState, DeviceState> states) { _states = states; SwitchOn(); }
public NotificationService(ICacheClient cacheClient, IKeyResolver nameResolver) { this.cacheClient = cacheClient; this.nameResolver = nameResolver; }