本文整理匯總了C#中System.Security.Cryptography.Xml.KeyInfo.GetEnumerator方法的典型用法代碼示例。如果您正苦於以下問題:C# KeyInfo.GetEnumerator方法的具體用法?C# KeyInfo.GetEnumerator怎麽用?C# KeyInfo.GetEnumerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Security.Cryptography.Xml.KeyInfo
的用法示例。
在下文中一共展示了KeyInfo.GetEnumerator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReadX509Certificates
// Reads the X.509 certificates contained within an IdP or SP SSO descriptor
private static void ReadX509Certificates(RoleDescriptorType roleDescriptor)
{
foreach (KeyDescriptor keyDescriptor in roleDescriptor.KeyDescriptors) {
KeyInfo keyInfo = new KeyInfo();
keyInfo.LoadXml(keyDescriptor.KeyInfo);
IEnumerator enumerator = keyInfo.GetEnumerator(typeof(KeyInfoX509Data));
while (enumerator.MoveNext()) {
KeyInfoX509Data keyInfoX509Data = (KeyInfoX509Data)enumerator.Current;
foreach (X509Certificate2 x509Certificate in keyInfoX509Data.Certificates) {
Console.WriteLine("X509 certificate: " + x509Certificate.ToString());
}
}
foreach (XmlElement xmlElement in keyDescriptor.EncryptionMethods) {
Console.WriteLine("Encryption method: " + KeyDescriptor.GetEncryptionMethodAlgorithm(xmlElement));
}
}
}