2010-01-09 Marek Habersack <mhabersack@novell.com>
[mono.git] / mcs / class / System.Configuration / System.Configuration / ProtectedConfigurationSection.cs
index a493c019b905c1cb46f5e9daef99a16eecb3c307..710396f8326e09e02e68551d2066897b8dfdb69f 100644 (file)
@@ -29,6 +29,9 @@
 
 #if NET_2_0
 
+using System.IO;
+using System.Xml;
+
 namespace System.Configuration
 {
        public sealed class ProtectedConfigurationSection: ConfigurationSection
@@ -64,6 +67,26 @@ namespace System.Configuration
                        get { return properties; }
                }
 
+               internal string EncryptSection (string clearXml, ProtectedConfigurationProvider protectionProvider)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       doc.LoadXml (clearXml);
+
+                       XmlNode encryptedNode = protectionProvider.Encrypt (doc.DocumentElement);
+
+                       return encryptedNode.OuterXml;
+               }
+
+               internal string DecryptSection (string encryptedXml, ProtectedConfigurationProvider protectionProvider)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       doc.InnerXml = encryptedXml;
+
+                       XmlNode decryptedNode = protectionProvider.Decrypt (doc.DocumentElement);
+
+                       return decryptedNode.OuterXml;
+               }
+
                internal ProtectedConfigurationProviderCollection GetAllProviders ()
                {
                        if (providers == null) {