public async Task MockSecretManager()
        {
            var secretManager = new MockSecretManager();

            var keyVaultPlugin = new KeyVaultPlugin("service-bus", secretManager);

            var messageBody = Encoding.UTF8.GetBytes("hi");

            var message = new Message(messageBody);

            var encryptedMessage = await keyVaultPlugin.BeforeMessageSend(message);

            var decryptedMessage = await keyVaultPlugin.AfterMessageReceive(encryptedMessage);

            Assert.Equal(messageBody, decryptedMessage.Body);
        }
Beispiel #2
0
        public async Task SmokeTest()
        {
            var payload  = Encoding.UTF8.GetBytes("hello");
            var password = "******";

            var sha256 = SHA256.Create();
            var hash   = sha256.ComputeHash(Encoding.UTF8.GetBytes(password));

            var iV = KeyVaultPlugin.GenerateInitializationVector();

            var encryptedPayload = await KeyVaultPlugin.Encrypt(payload, hash, iV);

            var decryptedPayload = await KeyVaultPlugin.Decrypt(encryptedPayload, hash, iV);

            Assert.Equal(payload, decryptedPayload);
        }