Пример #1
0
        private static bool IsSecureConversationEnabled(BindingElementCollection bindingElements)
        {
            bool flag = false;

            for (int i = 0; i < bindingElements.Count; i++)
            {
                if (!flag)
                {
                    ReliableSessionBindingElement element = bindingElements[i] as ReliableSessionBindingElement;
                    flag = element != null;
                }
                else
                {
                    SecurityBindingElement element3;
                    SecurityBindingElement sbe = bindingElements[i] as SecurityBindingElement;
                    if (sbe == null)
                    {
                        break;
                    }
                    if (!SecurityBindingElement.IsSecureConversationBinding(sbe, true, out element3))
                    {
                        return(SecurityBindingElement.IsSecureConversationBinding(sbe, false, out element3));
                    }
                    return(true);
                }
            }
            return(false);
        }
        static bool IsSecureConversationEnabled(BindingElementCollection bindingElements)
        {
            bool foundRM = false;

            for (int i = 0; i < bindingElements.Count; i++)
            {
                if (!foundRM)
                {
                    ReliableSessionBindingElement bindingElement = bindingElements[i] as ReliableSessionBindingElement;
                    foundRM = (bindingElement != null);
                }
                else
                {
                    SecurityBindingElement securityBindingElement = bindingElements[i] as SecurityBindingElement;

                    if (securityBindingElement != null)
                    {
                        SecurityBindingElement bootstrapSecurity;

                        // The difference in bool (requireCancellation) does not affect whether the binding is valid,
                        // but the method does match on the value so we need to pass both true and false.
                        return(SecurityBindingElement.IsSecureConversationBinding(securityBindingElement, true, out bootstrapSecurity) ||
                               SecurityBindingElement.IsSecureConversationBinding(securityBindingElement, false, out bootstrapSecurity));
                    }

                    break;
                }
            }

            return(false);
        }