本文整理匯總了C#中System.Security.Cryptography.AsymmetricAlgorithm.FromXmlString方法的典型用法代碼示例。如果您正苦於以下問題:C# AsymmetricAlgorithm.FromXmlString方法的具體用法?C# AsymmetricAlgorithm.FromXmlString怎麽用?C# AsymmetricAlgorithm.FromXmlString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Security.Cryptography.AsymmetricAlgorithm
的用法示例。
在下文中一共展示了AsymmetricAlgorithm.FromXmlString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FromXmlString
// Expected XML schema:
// <ProviderName></ProviderName>
// <KeyContainerName></KeyContainerName>
// <KeyNumber></KeyNumber>
// <ProviderType></ProviderType>
public override void FromXmlString(string xmlString)
{
if (xmlString != null)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlString);
XmlNode firstNode = doc.FirstChild;
XmlNodeList nodeList;
// Assemble parameters from values in each XML element.
cspParameters = new CspParameters();
// KeyContainerName is optional.
nodeList = doc.GetElementsByTagName("KeyContainerName");
string keyName = nodeList.Item(0).InnerText;
if (keyName != null)
{
cspParameters.KeyContainerName = keyName;
}
// KeyNumber is optional.
nodeList = doc.GetElementsByTagName("KeyNumber");
string keyNumber = nodeList.Item(0).InnerText;
if (keyNumber != null)
{
cspParameters.KeyNumber = Int32.Parse(keyNumber);
}
// ProviderName is optional.
nodeList = doc.GetElementsByTagName("ProviderName");
string providerName = nodeList.Item(0).InnerText;
if (providerName != null)
{
cspParameters.ProviderName = providerName;
}
// ProviderType is optional.
nodeList = doc.GetElementsByTagName("ProviderType");
string providerType = nodeList.Item(0).InnerText;
if (providerType != null)
{
cspParameters.ProviderType = Int32.Parse(providerType);
}
}
else
{
throw new ArgumentNullException("xmlString");
}
}