本文整理汇总了C#中KeyInfo.ReadXml方法的典型用法代码示例。如果您正苦于以下问题:C# KeyInfo.ReadXml方法的具体用法?C# KeyInfo.ReadXml怎么用?C# KeyInfo.ReadXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyInfo
的用法示例。
在下文中一共展示了KeyInfo.ReadXml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadSigningKeyInfo
/// <summary>
/// Deserializes the SAML Signing KeyInfo
/// </summary>
/// <param name="reader">A <see cref="XmlReader"/> positioned at a than can be positioned at a ds:KeyInfo element.</param>
/// <param name="assertion">The <see cref="Saml2Assertion"/> that is having the signature checked.</param>
/// <returns>The <see cref="SecurityKeyIdentifier"/> that defines the key to use to check the signature.</returns>
/// <exception cref="ArgumentNullException">Input parameter 'reader' is null.</exception>
protected virtual SecurityKeyIdentifier ReadSigningKeyInfo(XmlReader reader, Saml2Assertion assertion)
{
if (null == reader)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader");
}
SecurityKeyIdentifier ski;
if (this.KeyInfoSerializer.CanReadKeyIdentifier(reader))
{
ski = this.KeyInfoSerializer.ReadKeyIdentifier(reader);
}
else
{
KeyInfo keyInfo = new KeyInfo(this.KeyInfoSerializer);
keyInfo.ReadXml(XmlDictionaryReader.CreateDictionaryReader(reader));
ski = keyInfo.KeyIdentifier;
}
// no key info
if (ski.Count == 0)
{
return new SecurityKeyIdentifier(new Saml2SecurityKeyIdentifierClause(assertion));
}
return ski;
}