public PeerSecurityCredentialsManager(PeerCredential credential, PeerAuthenticationMode mode, bool messageAuth)
 {
     this.mode = PeerAuthenticationMode.Password;
     this.credential = credential;
     this.mode = mode;
     this.messageAuth = messageAuth;
 }
 internal PeerCredential(PeerCredential other)
 {
     this.certificate                 = other.certificate;
     this.meshPassword                = other.meshPassword;
     this.peerAuthentication          = new X509PeerCertificateAuthentication(other.peerAuthentication);
     this.messageSenderAuthentication = new X509PeerCertificateAuthentication(other.messageSenderAuthentication);
     this.isReadOnly = other.isReadOnly;
 }
 internal PeerCredential(PeerCredential other)
 {
     this.certificate = other.certificate;
     this.meshPassword = other.meshPassword;
     this.peerAuthentication = new X509PeerCertificateAuthentication(other.peerAuthentication);
     this.messageSenderAuthentication = new X509PeerCertificateAuthentication(other.messageSenderAuthentication);
     this.isReadOnly = other.isReadOnly;
 }
 public ServiceCredentials()
 {
     this.userName = new UserNamePasswordServiceCredential();
     this.clientCertificate = new X509CertificateInitiatorServiceCredential();
     this.serviceCertificate = new X509CertificateRecipientServiceCredential();
     this.windows = new WindowsServiceCredential();
     this.issuedToken = new IssuedTokenServiceCredential();
     this.peer = new PeerCredential();
     this.secureConversation = new SecureConversationServiceCredential();
 }
 internal void ApplyConfiguration(PeerCredential cert)
 {
     if (cert == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("cert");
     }
     PropertyInformationCollection properties = base.ElementInformation.Properties;
     if (((properties["storeLocation"].ValueOrigin != PropertyValueOrigin.Default) || (properties["storeName"].ValueOrigin != PropertyValueOrigin.Default)) || ((properties["x509FindType"].ValueOrigin != PropertyValueOrigin.Default) || (properties["findValue"].ValueOrigin != PropertyValueOrigin.Default)))
     {
         cert.SetCertificate(this.StoreLocation, this.StoreName, this.X509FindType, this.FindValue);
     }
 }
 protected ServiceCredentials(ServiceCredentials other)
 {
     if (other == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other");
     }
     this.userName = new UserNamePasswordServiceCredential(other.userName);
     this.clientCertificate = new X509CertificateInitiatorServiceCredential(other.clientCertificate);
     this.serviceCertificate = new X509CertificateRecipientServiceCredential(other.serviceCertificate);
     this.windows = new WindowsServiceCredential(other.windows);
     this.issuedToken = new IssuedTokenServiceCredential(other.issuedToken);
     this.peer = new PeerCredential(other.peer);
     this.secureConversation = new SecureConversationServiceCredential(other.secureConversation);
 }
 internal void ApplyConfiguration(PeerCredential cert)
 {
     if (cert == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("cert");
     }
     PropertyInformationCollection propertyInfo = this.ElementInformation.Properties;
     if (propertyInfo[ConfigurationStrings.StoreLocation].ValueOrigin != PropertyValueOrigin.Default
         || propertyInfo[ConfigurationStrings.StoreName].ValueOrigin != PropertyValueOrigin.Default
         || propertyInfo[ConfigurationStrings.X509FindType].ValueOrigin != PropertyValueOrigin.Default
         || propertyInfo[ConfigurationStrings.FindValue].ValueOrigin != PropertyValueOrigin.Default)
     {
         cert.SetCertificate(this.StoreLocation, this.StoreName, this.X509FindType, this.FindValue);
     }
 }
        internal bool Equals(PeerCredential that, PeerAuthenticationMode mode, bool messageAuthentication)
        {
            if (messageAuthentication)
            {
                if (!this.SameAuthenticators(this.MessageSenderAuthentication, that.messageSenderAuthentication))
                {
                    return(false);
                }
                if (((this.Certificate != null) && (that.Certificate != null)) && !this.Certificate.Equals((X509Certificate)that.Certificate))
                {
                    return(false);
                }
            }
            switch (mode)
            {
            case PeerAuthenticationMode.None:
                return(true);

            case PeerAuthenticationMode.Password:
                if (this.MeshPassword.Equals(that.MeshPassword))
                {
                    if ((this.Certificate == null) && (that.Certificate == null))
                    {
                        return(true);
                    }
                    if ((this.Certificate != null) && this.Certificate.Equals((X509Certificate)that.Certificate))
                    {
                        break;
                    }
                    return(false);
                }
                return(false);

            case PeerAuthenticationMode.MutualCertificate:
                if (this.Certificate.Equals((X509Certificate)that.Certificate))
                {
                    if (!this.SameAuthenticators(this.PeerAuthentication, that.PeerAuthentication))
                    {
                        return(false);
                    }
                    break;
                }
                return(false);
            }
            return(true);
        }
        internal bool Equals(PeerCredential that, PeerAuthenticationMode mode, bool messageAuthentication)
        {
            if (messageAuthentication)
            {
                if (!this.SameAuthenticators(this.MessageSenderAuthentication, that.messageSenderAuthentication))
                {
                    return false;
                }
                if (((this.Certificate != null) && (that.Certificate != null)) && !this.Certificate.Equals((X509Certificate) that.Certificate))
                {
                    return false;
                }
            }
            switch (mode)
            {
                case PeerAuthenticationMode.None:
                    return true;

                case PeerAuthenticationMode.Password:
                    if (this.MeshPassword.Equals(that.MeshPassword))
                    {
                        if ((this.Certificate == null) && (that.Certificate == null))
                        {
                            return true;
                        }
                        if ((this.Certificate != null) && this.Certificate.Equals((X509Certificate) that.Certificate))
                        {
                            break;
                        }
                        return false;
                    }
                    return false;

                case PeerAuthenticationMode.MutualCertificate:
                    if (this.Certificate.Equals((X509Certificate) that.Certificate))
                    {
                        if (!this.SameAuthenticators(this.PeerAuthentication, that.PeerAuthentication))
                        {
                            return false;
                        }
                        break;
                    }
                    return false;
            }
            return true;
        }
 internal void ApplyConfiguration(PeerCredential creds)
 {
     if (creds == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("creds");
     }
     PropertyInformationCollection properties = base.ElementInformation.Properties;
     if (properties["certificate"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.Certificate.ApplyConfiguration(creds);
     }
     if (properties["peerAuthentication"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.PeerAuthentication.ApplyConfiguration(creds.PeerAuthentication);
     }
     if (properties["messageSenderAuthentication"].ValueOrigin != PropertyValueOrigin.Default)
     {
         this.MessageSenderAuthentication.ApplyConfiguration(creds.MessageSenderAuthentication);
     }
 }
 public PeerClientSecurityTokenManager(PeerSecurityManager parent, PeerCredential credential, PeerAuthenticationMode mode, bool messageAuth)
 {
     this.credential = credential;
     this.mode = mode;
     this.messageAuth = messageAuth;
     this.parent = parent;
 }
        protected ClientCredentials(ClientCredentials other)
        {
            if (other == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other");
            if (other.userName != null)
                this.userName = new UserNamePasswordClientCredential(other.userName);
            if (other.clientCertificate != null)
                this.clientCertificate = new X509CertificateInitiatorClientCredential(other.clientCertificate);
            if (other.serviceCertificate != null)
                this.serviceCertificate = new X509CertificateRecipientClientCredential(other.serviceCertificate);
            if (other.windows != null)
                this.windows = new WindowsClientCredential(other.windows);
            if (other.httpDigest != null)
                this.httpDigest = new HttpDigestClientCredential(other.httpDigest);
            if (other.issuedToken != null)
                this.issuedToken = new IssuedTokenClientCredential(other.issuedToken);
            if (other.peer != null)
                this.peer = new PeerCredential(other.peer);

            this.getInfoCardTokenCallback = other.getInfoCardTokenCallback;
            this.supportInteractive = other.supportInteractive;
            this.securityTokenHandlerCollectionManager = other.securityTokenHandlerCollectionManager;
            this.useIdentityConfiguration = other.useIdentityConfiguration;
            this.isReadOnly = other.isReadOnly;
        }