Esempio n. 1
0
        public void EncryptedValue_CanBeDecrypted()
        {
            using (var variables = new TestScopedEnvironmentVariable(Constants.AzureWebsiteLocalEncryptionKey, "0F75CA46E7EBDD39E4CA6B074D1F9A5972B849A55F91A248"))
            {
                var provider = DataProtectionProvider.CreateAzureDataProtector(null, true);

                var protector = provider.CreateProtector("test");

                string expected = "test string";

                string encrypted = protector.Protect(expected);

                string result = protector.Unprotect(encrypted);

                Assert.Equal(expected, result);
            }
        }