ProtectedConfigurationProvider.Encrypt(XmlNode) 方法   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
加密从配置文件传递的 XmlNode 对象。
public:
 abstract System::Xml::XmlNode ^ Encrypt(System::Xml::XmlNode ^ node);public abstract System.Xml.XmlNode Encrypt (System.Xml.XmlNode node);abstract member Encrypt : System.Xml.XmlNode -> System.Xml.XmlNodePublic MustOverride Function Encrypt (node As XmlNode) As XmlNode参数
返回
包含已加密数据的 XmlNode 对象。
示例
以下示例演示如何使用 Encrypt 来执行自定义加密。
// Performs encryption.
public override XmlNode Encrypt(XmlNode node)
{
    string encryptedData = EncryptString(node.OuterXml);
    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.PreserveWhitespace = true;
    xmlDoc.LoadXml("<EncryptedData>" +
        encryptedData + "</EncryptedData>");
    return xmlDoc.DocumentElement;
}
' Performs encryption.
Public Overrides Function Encrypt( _
ByVal node As XmlNode) As XmlNode
    Dim encryptedData As String = _
    EncryptString(node.OuterXml)
    Dim xmlDoc As New XmlDocument()
    xmlDoc.PreserveWhitespace = True
    xmlDoc.LoadXml( _
    ("<EncryptedData>" + encryptedData + _
    "</EncryptedData>"))
    Return xmlDoc.DocumentElement
End Function 'Encrypt
实施者说明
重写此方法以执行自定义加密。