public AppEncryptionJsonMultiThreadedTest() { payload = PayloadGenerator.CreateDefaultRandomJsonPayload(); appEncryptionSessionFactory = SessionFactoryGenerator.CreateDefaultAppEncryptionSessionFactory(); partitionId = DefaultPartitionId + "_" + DateTimeUtils.GetCurrentTimeAsUtcIsoDateTimeOffset(); appEncryptionJson = appEncryptionSessionFactory.GetAppEncryptionJson(partitionId); }
public AppEncryptionBytesTest() { payload = PayloadGenerator.CreateDefaultRandomBytePayload(); appEncryptionSessionFactory = SessionFactoryGenerator.CreateDefaultAppEncryptionSessionFactory(); partitionId = DefaultPartitionId + "_" + DateTimeUtils.GetCurrentTimeAsUtcIsoDateTimeOffset(); appEncryptionBytes = appEncryptionSessionFactory.GetAppEncryptionBytes(partitionId); }
public AppEncryptionJsonMultiThreadedTest(ConfigFixture configFixture) { payload = PayloadGenerator.CreateDefaultRandomJsonPayload(); appEncryptionSessionFactory = SessionFactoryGenerator.CreateDefaultAppEncryptionSessionFactory( configFixture.KeyManagementService, configFixture.MetastorePersistence); partitionId = DefaultPartitionId + "_" + DateTimeUtils.GetCurrentTimeAsUtcIsoDateTimeOffset(); appEncryptionJson = appEncryptionSessionFactory.GetAppEncryptionJson(partitionId); }
private void RunPartitionTest(int testIterations, string partitionId, int payloadSizeBytesBase) { try { using (AppEncryptionSessionFactory factory = SessionFactoryGenerator.CreateDefaultAppEncryptionSessionFactory( configFixture.KeyManagementService, configFixture.MetastorePersistence)) { using (AppEncryption <JObject, byte[]> partition = factory.GetAppEncryptionJson(partitionId)) { Dictionary <string, byte[]> dataStore = new Dictionary <string, byte[]>(); string partitionPart = $"partition-{partitionId}-"; for (int i = 0; i < testIterations; i++) { // Note the size will be slightly larger since we're adding extra unique meta JObject jObject = PayloadGenerator.CreateRandomJsonPayload(payloadSizeBytesBase); string keyPart = $"iteration-{i}"; jObject["payload"] = partitionPart + keyPart; dataStore.Add(keyPart, partition.Encrypt(jObject)); } foreach (KeyValuePair <string, byte[]> keyValuePair in dataStore) { JObject decryptedObject = partition.Decrypt(keyValuePair.Value); Assert.Equal(partitionPart + keyValuePair.Key, decryptedObject["payload"].ToObject <string>()); } } } } catch (Exception e) { Logger.LogError(e, "Unexpected error during call"); throw; } }
public MultiPartitionMultiThreadedTest(ConfigFixture configFixture) { appEncryptionSessionFactory = SessionFactoryGenerator.CreateDefaultAppEncryptionSessionFactory( configFixture.KeyManagementService, configFixture.MetastorePersistence); }
public MultiPartitionMultiThreadedTest() { appEncryptionSessionFactory = SessionFactoryGenerator.CreateDefaultAppEncryptionSessionFactory(); }