当前位置: 首页>>代码示例>>C#>>正文


C# SecurityBindingElement.GetType方法代码示例

本文整理汇总了C#中SecurityBindingElement.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# SecurityBindingElement.GetType方法的具体用法?C# SecurityBindingElement.GetType怎么用?C# SecurityBindingElement.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SecurityBindingElement的用法示例。


在下文中一共展示了SecurityBindingElement.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AreBindingsMatching

        internal static bool AreBindingsMatching(SecurityBindingElement b1, SecurityBindingElement b2, bool exactMessageSecurityVersion)
        {
            if (b1 == null || b2 == null)
                return b1 == b2;
 
            if (b1.GetType() != b2.GetType())
                return false;

            if (b1.MessageSecurityVersion != b2.MessageSecurityVersion)
            {
                // exactMessageSecurityVersion meant that BSP mismatch could be ignored
                if (exactMessageSecurityVersion)
                    return false;

                if (b1.MessageSecurityVersion.SecurityVersion != b2.MessageSecurityVersion.SecurityVersion
                 || b1.MessageSecurityVersion.TrustVersion != b2.MessageSecurityVersion.TrustVersion
                 || b1.MessageSecurityVersion.SecureConversationVersion != b2.MessageSecurityVersion.SecureConversationVersion
                 || b1.MessageSecurityVersion.SecurityPolicyVersion != b2.MessageSecurityVersion.SecurityPolicyVersion)
                {
                    return false;
                }
            }

            if (b1.SecurityHeaderLayout != b2.SecurityHeaderLayout)
                return false;

            if (b1.DefaultAlgorithmSuite != b2.DefaultAlgorithmSuite)
                return false;

            if (b1.IncludeTimestamp != b2.IncludeTimestamp)
                return false;

            if (b1.SecurityHeaderLayout != b2.SecurityHeaderLayout)
                return false;

            if (b1.KeyEntropyMode != b2.KeyEntropyMode)
                return false;

            if (!AreTokenParameterCollectionsMatching(b1.EndpointSupportingTokenParameters.Endorsing, b2.EndpointSupportingTokenParameters.Endorsing, exactMessageSecurityVersion))
                return false;

            if (!AreTokenParameterCollectionsMatching(b1.EndpointSupportingTokenParameters.SignedEncrypted, b2.EndpointSupportingTokenParameters.SignedEncrypted, exactMessageSecurityVersion))
                return false;

            if (!AreTokenParameterCollectionsMatching(b1.EndpointSupportingTokenParameters.Signed, b2.EndpointSupportingTokenParameters.Signed, exactMessageSecurityVersion))
                return false;

            if (!AreTokenParameterCollectionsMatching(b1.EndpointSupportingTokenParameters.SignedEndorsing, b2.EndpointSupportingTokenParameters.SignedEndorsing, exactMessageSecurityVersion))
                return false;

            if (b1.OperationSupportingTokenParameters.Count != b2.OperationSupportingTokenParameters.Count)
                return false;

            foreach (KeyValuePair<string, SupportingTokenParameters> operation1 in b1.OperationSupportingTokenParameters)
            {
                if (!b2.OperationSupportingTokenParameters.ContainsKey(operation1.Key))
                    return false;

                SupportingTokenParameters stp2 = b2.OperationSupportingTokenParameters[operation1.Key];

                if (!AreTokenParameterCollectionsMatching(operation1.Value.Endorsing, stp2.Endorsing, exactMessageSecurityVersion))
                    return false;

                if (!AreTokenParameterCollectionsMatching(operation1.Value.SignedEncrypted, stp2.SignedEncrypted, exactMessageSecurityVersion))
                    return false;

                if (!AreTokenParameterCollectionsMatching(operation1.Value.Signed, stp2.Signed, exactMessageSecurityVersion))
                    return false;

                if (!AreTokenParameterCollectionsMatching(operation1.Value.SignedEndorsing, stp2.SignedEndorsing, exactMessageSecurityVersion))
                    return false;
            }

            SymmetricSecurityBindingElement ssbe1 = b1 as SymmetricSecurityBindingElement;            
            if (ssbe1 != null)
            {
                SymmetricSecurityBindingElement ssbe2 = (SymmetricSecurityBindingElement)b2;

                if (ssbe1.MessageProtectionOrder != ssbe2.MessageProtectionOrder)
                    return false;

                if (!AreTokenParametersMatching(ssbe1.ProtectionTokenParameters, ssbe2.ProtectionTokenParameters, false, exactMessageSecurityVersion))
                    return false;
            }

            AsymmetricSecurityBindingElement asbe1 = b1 as AsymmetricSecurityBindingElement;
            if (asbe1 != null)
            {
                AsymmetricSecurityBindingElement asbe2 = (AsymmetricSecurityBindingElement)b2;

                if (asbe1.MessageProtectionOrder != asbe2.MessageProtectionOrder)
                    return false;

                if (asbe1.RequireSignatureConfirmation != asbe2.RequireSignatureConfirmation)
                    return false;

                if (!AreTokenParametersMatching(asbe1.InitiatorTokenParameters, asbe2.InitiatorTokenParameters, true, exactMessageSecurityVersion)
                    || !AreTokenParametersMatching(asbe1.RecipientTokenParameters, asbe2.RecipientTokenParameters, true, exactMessageSecurityVersion))
                    return false;
            }
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:SecurityElementBase.cs

示例2: AreBindingsMatching

 internal static bool AreBindingsMatching(SecurityBindingElement b1, SecurityBindingElement b2, bool exactMessageSecurityVersion)
 {
     if ((b1 == null) || (b2 == null))
     {
         return (b1 == b2);
     }
     if (b1.GetType() != b2.GetType())
     {
         return false;
     }
     if (b1.MessageSecurityVersion != b2.MessageSecurityVersion)
     {
         if (exactMessageSecurityVersion)
         {
             return false;
         }
         if (((b1.MessageSecurityVersion.SecurityVersion != b2.MessageSecurityVersion.SecurityVersion) || (b1.MessageSecurityVersion.TrustVersion != b2.MessageSecurityVersion.TrustVersion)) || ((b1.MessageSecurityVersion.SecureConversationVersion != b2.MessageSecurityVersion.SecureConversationVersion) || (b1.MessageSecurityVersion.SecurityPolicyVersion != b2.MessageSecurityVersion.SecurityPolicyVersion)))
         {
             return false;
         }
     }
     if (b1.SecurityHeaderLayout != b2.SecurityHeaderLayout)
     {
         return false;
     }
     if (b1.DefaultAlgorithmSuite != b2.DefaultAlgorithmSuite)
     {
         return false;
     }
     if (b1.IncludeTimestamp != b2.IncludeTimestamp)
     {
         return false;
     }
     if (b1.SecurityHeaderLayout != b2.SecurityHeaderLayout)
     {
         return false;
     }
     if (b1.KeyEntropyMode != b2.KeyEntropyMode)
     {
         return false;
     }
     if (!AreTokenParameterCollectionsMatching(b1.EndpointSupportingTokenParameters.Endorsing, b2.EndpointSupportingTokenParameters.Endorsing, exactMessageSecurityVersion))
     {
         return false;
     }
     if (!AreTokenParameterCollectionsMatching(b1.EndpointSupportingTokenParameters.SignedEncrypted, b2.EndpointSupportingTokenParameters.SignedEncrypted, exactMessageSecurityVersion))
     {
         return false;
     }
     if (!AreTokenParameterCollectionsMatching(b1.EndpointSupportingTokenParameters.Signed, b2.EndpointSupportingTokenParameters.Signed, exactMessageSecurityVersion))
     {
         return false;
     }
     if (!AreTokenParameterCollectionsMatching(b1.EndpointSupportingTokenParameters.SignedEndorsing, b2.EndpointSupportingTokenParameters.SignedEndorsing, exactMessageSecurityVersion))
     {
         return false;
     }
     if (b1.OperationSupportingTokenParameters.Count != b2.OperationSupportingTokenParameters.Count)
     {
         return false;
     }
     foreach (KeyValuePair<string, SupportingTokenParameters> pair in b1.OperationSupportingTokenParameters)
     {
         if (!b2.OperationSupportingTokenParameters.ContainsKey(pair.Key))
         {
             return false;
         }
         SupportingTokenParameters parameters = b2.OperationSupportingTokenParameters[pair.Key];
         if (!AreTokenParameterCollectionsMatching(pair.Value.Endorsing, parameters.Endorsing, exactMessageSecurityVersion))
         {
             return false;
         }
         if (!AreTokenParameterCollectionsMatching(pair.Value.SignedEncrypted, parameters.SignedEncrypted, exactMessageSecurityVersion))
         {
             return false;
         }
         if (!AreTokenParameterCollectionsMatching(pair.Value.Signed, parameters.Signed, exactMessageSecurityVersion))
         {
             return false;
         }
         if (!AreTokenParameterCollectionsMatching(pair.Value.SignedEndorsing, parameters.SignedEndorsing, exactMessageSecurityVersion))
         {
             return false;
         }
     }
     SymmetricSecurityBindingElement element = b1 as SymmetricSecurityBindingElement;
     if (element != null)
     {
         SymmetricSecurityBindingElement element2 = (SymmetricSecurityBindingElement) b2;
         if (element.MessageProtectionOrder != element2.MessageProtectionOrder)
         {
             return false;
         }
         if (!AreTokenParametersMatching(element.ProtectionTokenParameters, element2.ProtectionTokenParameters, false, exactMessageSecurityVersion))
         {
             return false;
         }
     }
     AsymmetricSecurityBindingElement element3 = b1 as AsymmetricSecurityBindingElement;
     if (element3 != null)
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:SecurityElementBase.cs


注:本文中的SecurityBindingElement.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。