public void ConfigurationProtectorTestWithoutDpapi()
 {
     string mySecret = "mary had a little lamb";
     RijndaelManaged myRijndael = new RijndaelManaged();
     myRijndael.GenerateKey();
     KeyAlgorithmPair pair = new KeyAlgorithmPair(myRijndael.Key, myRijndael.GetType().AssemblyQualifiedName);
     SaveKeyPair(pair, xmlString);
     ConfigurationContext context = CreateContext(xmlString);
     using (ConfigurationProtector protector = new ConfigurationProtector())
     {
         protector.Load(context, sectionName);
         byte[] inBytes = UnicodeEncoding.Unicode.GetBytes(mySecret);
         byte[] encryptedBytes = protector.Encrypt(inBytes);
         Assert.IsFalse(CryptographyUtility.CompareBytes(inBytes, encryptedBytes));
         byte[] decryptedBytes = protector.Decrypt(encryptedBytes);
         Assert.AreEqual(mySecret, UnicodeEncoding.Unicode.GetString(decryptedBytes));
     }
 }
 public void ConfigurationProtectorTestEncryptedButNoProvider()
 {
     RijndaelManaged myRijndael = new RijndaelManaged();
     myRijndael.GenerateKey();
     KeyAlgorithmPair pair = new KeyAlgorithmPair(myRijndael.Key, myRijndael.GetType().AssemblyQualifiedName);
     SaveKeyPair(pair, xmlStringWithDpapi);
     using (ConfigurationContext context = CreateContext(xmlStringNoStorageProvider))
     {
         using (ConfigurationProtector protector = new ConfigurationProtector())
         {
             protector.Load(context, sectionName);
         }
     }
 }