public AesEncryptedMongoDBFixture() { var rng = new Random(); DatabaseName = $"AesEncryptedMongoDBFixture_{rng.Next(int.MaxValue):X}"; // docker run -it --rm --name mongodb -p 27027:27017 mongo:3.6.0-jessie ConnectionStringSettings = new ConnectionStringSettings { Name = DatabaseName, ConnectionString = $"mongodb://localhost:27027/{DatabaseName}?maxpoolsize=1000" }; #if NET452 var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.ConnectionStrings.ConnectionStrings.Remove(ConnectionStringSettings.Name); config.ConnectionStrings.ConnectionStrings.Add(ConnectionStringSettings); config.Save(); ConfigurationManager.RefreshSection("connectionStrings"); #endif #if NETCOREAPP2_0 ConfigurationManager.ConnectionStrings[ConnectionStringSettings.Name] = ConnectionStringSettings; #endif Database = MongoDBHelper.Connect(ConnectionStringSettings, DatabaseName); var encryptionServiceOptions = new AesMessageEncryptionOptions(KeyGenerator.GenerateAesKey()); var messageQueueingOptions = new MongoDBMessageQueueingOptions(Database) { DiagnosticService = DiagnosticService, MessageEncryptionService = new AesMessageEncryptionService(encryptionServiceOptions) }; MessageQueueingService = new MongoDBMessageQueueingService(messageQueueingOptions); }
public AesEncryptedRabbitMQFixture() { // docker run -it --rm --name rabbitmq -p 5682:5672 -p 15682:15672 rabbitmq:3-management Uri = new Uri("amqp://*****:*****@localhost:5682"); WaitForRabbitMQ(Uri); var encryptionOptions = new AesMessageEncryptionOptions(KeyGenerator.GenerateAesKey()) { DiagnosticService = DiagnosticService }; MessageEncryptionService = new AesMessageEncryptionService(encryptionOptions); var queueingOptions = new RabbitMQMessageQueueingOptions(Uri) { DiagnosticService = DiagnosticService, DefaultQueueOptions = new QueueOptions { IsDurable = false }, MessageEncryptionService = MessageEncryptionService }; MessageQueueingService = new RabbitMQMessageQueueingService(queueingOptions); }
protected void GivenEncryption() { #if NET452 Configuration.Encryption = new EncryptionElement { Enabled = true, Provider = "AES", Key = HexEncoding.GetString(KeyGenerator.GenerateAesKey().GetSymmetricKey()) }; #endif #if NETCOREAPP2_0 var section = Configuration.GetSection("encryption"); section["enabled"] = "true"; section["provider"] = "aes"; section["key"] = HexEncoding.GetString(KeyGenerator.GenerateAesKey().Key); #endif }
public AesEncryptedFilesystemFixture() { BaseDirectory = GetTempDirectory(); var aesOptions = new AesMessageEncryptionOptions(KeyGenerator.GenerateAesKey()) { DiagnosticService = DiagnosticService }; MessageEncryptionService = new AesMessageEncryptionService(aesOptions); var fsQueueingOptions = new FilesystemMessageQueueingOptions { DiagnosticService = DiagnosticService, BaseDirectory = BaseDirectory, MessageEncryptionService = MessageEncryptionService }; MessageQueueingService = new FilesystemMessageQueueingService(fsQueueingOptions); MessageQueueingService.Init(); }
public AesEncryptedSQLiteFixture() { BaseDirectory = GetTempDirectory(); var aesOptions = new AesMessageEncryptionOptions(KeyGenerator.GenerateAesKey()) { DiagnosticService = DiagnosticService }; MessageEncryptionService = new AesMessageEncryptionService(aesOptions); QueueDirectory = CreateSubdirectory(BaseDirectory, "queues"); var queueingOptions = new SQLiteMessageQueueingOptions { DiagnosticService = DiagnosticService, BaseDirectory = QueueDirectory, MessageEncryptionService = MessageEncryptionService }; MessageQueueingService = new SQLiteMessageQueueingService(queueingOptions); MessageQueueingService.Init(); }
public AesEncryptedLocalDBFixture() { var connectionStringSettings = ConfigurationManager.ConnectionStrings["PlatibusUnitTests.LocalDB"]; ConnectionProvider = new DefaultConnectionProvider(connectionStringSettings); var aesOptions = new AesMessageEncryptionOptions(KeyGenerator.GenerateAesKey()) { DiagnosticService = DiagnosticService }; MessageEncryptionService = new AesMessageEncryptionService(aesOptions); var queueingOptions = new SQLMessageQueueingOptions(ConnectionProvider, new MSSQLMessageQueueingCommandBuilders()) { DiagnosticService = DiagnosticService, MessageEncryptionService = MessageEncryptionService }; MessageQueueingService = new SQLMessageQueueingService(queueingOptions); MessageQueueingService.Init(); DeleteQueuedMessages(); }