SslStreamSecurityElement.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / SslStreamSecurityElement.cs / 1 / SslStreamSecurityElement.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.ServiceModel.Configuration 
{
    using System.Configuration; 
    using System.ServiceModel.Channels; 

    public sealed partial class SslStreamSecurityElement : BindingElementExtensionElement 
    {
        public SslStreamSecurityElement()
        {
        } 

        [ConfigurationProperty( 
            ConfigurationStrings.RequireClientCertificate, DefaultValue = TransportDefaults.RequireClientCertificate)] 
        public bool RequireClientCertificate
        { 
            get { return (bool)base[ConfigurationStrings.RequireClientCertificate]; }
            set { base[ConfigurationStrings.RequireClientCertificate] = value; }
        }
 
        public override void ApplyConfiguration(BindingElement bindingElement)
        { 
            base.ApplyConfiguration(bindingElement); 
            SslStreamSecurityBindingElement sslBindingElement =
                (SslStreamSecurityBindingElement)bindingElement; 
            sslBindingElement.RequireClientCertificate = this.RequireClientCertificate;
        }

        protected internal override BindingElement CreateBindingElement() 
        {
            SslStreamSecurityBindingElement sslBindingElement 
                = new SslStreamSecurityBindingElement(); 

            this.ApplyConfiguration(sslBindingElement); 
            return sslBindingElement;
        }

        public override Type BindingElementType 
        {
            get { return typeof(SslStreamSecurityBindingElement); } 
        } 

        public override void CopyFrom(ServiceModelExtensionElement from) 
        {
            base.CopyFrom(from);

            SslStreamSecurityElement source = (SslStreamSecurityElement)from; 
#pragma warning suppress 56506 // [....], base.CopyFrom() validates the argument
            this.RequireClientCertificate = source.RequireClientCertificate; 
        } 

        protected internal override void InitializeFrom(BindingElement bindingElement) 
        {
            base.InitializeFrom(bindingElement);
            SslStreamSecurityBindingElement sslBindingElement
                = (SslStreamSecurityBindingElement)bindingElement; 
            this.RequireClientCertificate = sslBindingElement.RequireClientCertificate;
        } 
    } 
}
 



// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK