NetMsmqSecurity(NetMsmqSecurityMode mode, MsmqTransportSecurity transportSecurity, MessageSecurityOverMsmq messageSecurity)
        {
            Fx.Assert(NetMsmqSecurityModeHelper.IsDefined(mode), string.Format("Invalid NetMsmqSecurityMode value: {0}.", mode.ToString()));

            this.mode = mode;
            this.transportSecurity = transportSecurity == null ? new MsmqTransportSecurity() : transportSecurity;
            this.messageSecurity   = messageSecurity == null ? new MessageSecurityOverMsmq() : messageSecurity;
        }
        NetMsmqSecurity(NetMsmqSecurityMode mode, MsmqTransportSecurity transportSecurity, MessageSecurityOverMsmq messageSecurity)
        {
            Fx.Assert(NetMsmqSecurityModeHelper.IsDefined(mode), string.Format("Invalid NetMsmqSecurityMode value: {0}.", mode.ToString()));

            this.mode = mode;
            this.transportSecurity = transportSecurity == null ? new MsmqTransportSecurity() : transportSecurity;
            this.messageSecurity = messageSecurity == null ? new MessageSecurityOverMsmq() : messageSecurity;
        }
 public MsmqTransportSecurity(MsmqTransportSecurity other)
 {
     if (null == other)
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other");
     this.msmqAuthenticationMode = other.MsmqAuthenticationMode;
     this.msmqEncryptionAlgorithm = other.MsmqEncryptionAlgorithm;
     this.msmqHashAlgorithm = other.MsmqSecureHashAlgorithm;
     this.msmqProtectionLevel = other.MsmqProtectionLevel;
 }
Ejemplo n.º 4
0
		public void DefaultValues ()
		{
			MsmqTransportSecurity security = new MsmqTransportSecurity ();

			Assert.AreEqual (MsmqAuthenticationMode.WindowsDomain, security.MsmqAuthenticationMode, "#A1");
			Assert.AreEqual (MsmqEncryptionAlgorithm.RC4Stream, security.MsmqEncryptionAlgorithm, "#A2");
			Assert.AreEqual (ProtectionLevel.Sign, security.MsmqProtectionLevel, "#A3");
			Assert.AreEqual (MsmqSecureHashAlgorithm.Sha1, security.MsmqSecureHashAlgorithm, "#A4");
		}
        internal void ApplyConfiguration(MsmqTransportSecurity security)
        {
            if (security == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security");

            security.MsmqAuthenticationMode = this.MsmqAuthenticationMode;
            security.MsmqEncryptionAlgorithm = this.MsmqEncryptionAlgorithm;
            security.MsmqProtectionLevel = this.MsmqProtectionLevel;
            security.MsmqSecureHashAlgorithm = this.MsmqSecureHashAlgorithm;
        }
        internal void InitializeFrom(MsmqTransportSecurity security)
        {
            if (security == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security");

            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MsmqAuthenticationMode, security.MsmqAuthenticationMode);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MsmqEncryptionAlgorithm, security.MsmqEncryptionAlgorithm);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MsmqProtectionLevel, security.MsmqProtectionLevel);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MsmqSecureHashAlgorithm, security.MsmqSecureHashAlgorithm);            
        }
Ejemplo n.º 7
0
 public MsmqTransportSecurity(MsmqTransportSecurity other)
 {
     if (other == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other");
     }
     this.msmqAuthenticationMode  = other.MsmqAuthenticationMode;
     this.msmqEncryptionAlgorithm = other.MsmqEncryptionAlgorithm;
     this.msmqHashAlgorithm       = other.MsmqSecureHashAlgorithm;
     this.msmqProtectionLevel     = other.MsmqProtectionLevel;
 }
 internal void InitializeFrom(MsmqTransportSecurity security)
 {
     if (security == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security");
     }
     this.MsmqAuthenticationMode = security.MsmqAuthenticationMode;
     this.MsmqEncryptionAlgorithm = security.MsmqEncryptionAlgorithm;
     this.MsmqProtectionLevel = security.MsmqProtectionLevel;
     this.MsmqSecureHashAlgorithm = security.MsmqSecureHashAlgorithm;
 }
 internal MsmqReceiveParameters(MsmqBindingElementBase bindingElement, MsmqUri.IAddressTranslator addressTranslator)
 {
     this.addressTranslator = addressTranslator;
     this.durable = bindingElement.Durable;
     this.exactlyOnce = bindingElement.ExactlyOnce;
     this.maxRetryCycles = bindingElement.MaxRetryCycles;
     this.receiveErrorHandling = bindingElement.ReceiveErrorHandling;
     this.receiveRetryCount = bindingElement.ReceiveRetryCount;
     this.retryCycleDelay = bindingElement.RetryCycleDelay;
     this.transportSecurity = new MsmqTransportSecurity(bindingElement.MsmqTransportSecurity);
     this.useMsmqTracing = bindingElement.UseMsmqTracing;
     this.useSourceJournal = bindingElement.UseSourceJournal;
     this.receiveContextSettings = new MsmqReceiveContextSettings(bindingElement.ReceiveContextSettings);
 }
 internal MsmqBindingElementBase()
 {
     this.customDeadLetterQueue = null;
     this.deadLetterQueue       = System.ServiceModel.DeadLetterQueue.System;
     this.durable                = true;
     this.exactlyOnce            = true;
     this.maxRetryCycles         = 2;
     this.receiveContextEnabled  = true;
     this.receiveErrorHandling   = System.ServiceModel.ReceiveErrorHandling.Fault;
     this.receiveRetryCount      = 5;
     this.retryCycleDelay        = MsmqDefaults.RetryCycleDelay;
     this.timeToLive             = MsmqDefaults.TimeToLive;
     this.msmqTransportSecurity  = new System.ServiceModel.MsmqTransportSecurity();
     this.useMsmqTracing         = false;
     this.useSourceJournal       = false;
     this.ReceiveContextSettings = new MsmqReceiveContextSettings();
 }
 internal MsmqBindingElementBase(MsmqBindingElementBase elementToBeCloned) : base(elementToBeCloned)
 {
     this.customDeadLetterQueue = elementToBeCloned.customDeadLetterQueue;
     this.deadLetterQueue       = elementToBeCloned.deadLetterQueue;
     this.durable                = elementToBeCloned.durable;
     this.exactlyOnce            = elementToBeCloned.exactlyOnce;
     this.maxRetryCycles         = elementToBeCloned.maxRetryCycles;
     this.msmqTransportSecurity  = new System.ServiceModel.MsmqTransportSecurity(elementToBeCloned.MsmqTransportSecurity);
     this.receiveContextEnabled  = elementToBeCloned.ReceiveContextEnabled;
     this.receiveErrorHandling   = elementToBeCloned.receiveErrorHandling;
     this.receiveRetryCount      = elementToBeCloned.receiveRetryCount;
     this.retryCycleDelay        = elementToBeCloned.retryCycleDelay;
     this.timeToLive             = elementToBeCloned.timeToLive;
     this.useMsmqTracing         = elementToBeCloned.useMsmqTracing;
     this.useSourceJournal       = elementToBeCloned.useSourceJournal;
     this.ReceiveContextSettings = elementToBeCloned.ReceiveContextSettings;
 }
Ejemplo n.º 12
0
 protected MsmqChannelFactoryBase(MsmqBindingElementBase bindingElement, BindingContext context, MessageEncoderFactory encoderFactory) : base(bindingElement, context)
 {
     this.exactlyOnce           = true;
     this.addressTranslator     = bindingElement.AddressTranslator;
     this.customDeadLetterQueue = bindingElement.CustomDeadLetterQueue;
     this.durable               = bindingElement.Durable;
     this.deadLetterQueue       = bindingElement.DeadLetterQueue;
     this.exactlyOnce           = bindingElement.ExactlyOnce;
     this.msmqTransportSecurity = new System.ServiceModel.MsmqTransportSecurity(bindingElement.MsmqTransportSecurity);
     this.timeToLive            = bindingElement.TimeToLive;
     this.useMsmqTracing        = bindingElement.UseMsmqTracing;
     this.useSourceJournal      = bindingElement.UseSourceJournal;
     if (this.MsmqTransportSecurity.MsmqAuthenticationMode == MsmqAuthenticationMode.Certificate)
     {
         this.InitializeSecurityTokenManager(context);
     }
     if (null != this.customDeadLetterQueue)
     {
         this.deadLetterQueuePathName = MsmqUri.DeadLetterQueueAddressTranslator.UriToFormatName(this.customDeadLetterQueue);
     }
 }
 public MsmqTransportSecurity(MsmqTransportSecurity other)
 {
 }
 private NetMsmqSecurity(NetMsmqSecurityMode mode, MsmqTransportSecurity transportSecurity, MessageSecurityOverMsmq messageSecurity)
 {
     this.mode = mode;
     this.transportSecurity = (transportSecurity == null) ? new MsmqTransportSecurity() : transportSecurity;
     this.messageSecurity = (messageSecurity == null) ? new MessageSecurityOverMsmq() : messageSecurity;
 }
Ejemplo n.º 15
0
 private NetMsmqSecurity(NetMsmqSecurityMode mode, MsmqTransportSecurity transportSecurity, MessageSecurityOverMsmq messageSecurity)
 {
     this.mode = mode;
     this.transportSecurity = (transportSecurity == null) ? new MsmqTransportSecurity() : transportSecurity;
     this.messageSecurity   = (messageSecurity == null) ? new MessageSecurityOverMsmq() : messageSecurity;
 }
Ejemplo n.º 16
0
        public static List<NetMsmqBinding> GetNetMsmqBindings(string exeConfigPath)
        {
            var svcSection = Read.Config.ExeConfig.GetServiceModelSection(exeConfigPath);

            var configs = new List<NetMsmqBinding>();
            foreach (
                var section in
                    svcSection.Bindings.NetMsmqBinding.ConfiguredBindings
                        .Cast<NetMsmqBindingElement>())
            {
                var df = new NetMsmqBinding();
                var binding = new NetMsmqBinding
                {
                    Name = section.Name,
                    MaxBufferPoolSize = section.MaxBufferPoolSize > 0 ? section.MaxBufferPoolSize : df.MaxBufferPoolSize,
                    MaxReceivedMessageSize = section.MaxReceivedMessageSize > 0 ? section.MaxReceivedMessageSize : df.MaxReceivedMessageSize,
                    CloseTimeout = section.CloseTimeout != TimeSpan.Zero ? section.CloseTimeout : df.CloseTimeout,
                    OpenTimeout = section.OpenTimeout != TimeSpan.Zero ? section.OpenTimeout : df.OpenTimeout,
                    SendTimeout = section.SendTimeout != TimeSpan.Zero ? section.SendTimeout : df.SendTimeout,
                    ReceiveTimeout =
                        section.ReceiveTimeout != TimeSpan.Zero ? section.ReceiveTimeout : df.ReceiveTimeout,

                    MaxRetryCycles = section.MaxRetryCycles > 0 ? section.MaxRetryCycles : df.MaxRetryCycles,
                    ReceiveRetryCount = section.ReceiveRetryCount > 0 ? section.ReceiveRetryCount : df.ReceiveRetryCount,
                    RetryCycleDelay = section.RetryCycleDelay != TimeSpan.Zero ? section.RetryCycleDelay : df.RetryCycleDelay,
                    TimeToLive = section.TimeToLive != TimeSpan.Zero ? section.TimeToLive : df.TimeToLive,

                    DeadLetterQueue = section.DeadLetterQueue,
                    Durable = section.Durable,
                    ExactlyOnce = section.ExactlyOnce,
                    ReceiveErrorHandling = section.ReceiveErrorHandling,
                    UseSourceJournal = section.UseSourceJournal,
                    UseMsmqTracing = section.UseMsmqTracing,
                    QueueTransferProtocol = section.QueueTransferProtocol,
                    UseActiveDirectory = section.UseActiveDirectory
                };

                var readerQuotasSection = section.ReaderQuotas;
                var readerQuotas = new System.Xml.XmlDictionaryReaderQuotas();
                if (readerQuotasSection != null && readerQuotasSection.MaxDepth > 0)
                {
                    readerQuotas.MaxDepth = readerQuotasSection.MaxDepth;
                    readerQuotas.MaxStringContentLength = readerQuotasSection.MaxStringContentLength;
                    readerQuotas.MaxArrayLength = readerQuotasSection.MaxArrayLength;
                    readerQuotas.MaxBytesPerRead = readerQuotasSection.MaxBytesPerRead;
                    readerQuotas.MaxNameTableCharCount = readerQuotasSection.MaxNameTableCharCount;
                }
                else
                {
                    readerQuotas = null;
                }
                var msmqSecurity = new NetMsmqSecurity {Mode = section.Security.Mode};
                var securityTransportSection = section.Security.Transport;
                var msmqSecurityTransport = new MsmqTransportSecurity
                {
                    MsmqAuthenticationMode = securityTransportSection.MsmqAuthenticationMode,
                    MsmqEncryptionAlgorithm = securityTransportSection.MsmqEncryptionAlgorithm,
                    MsmqProtectionLevel = securityTransportSection.MsmqProtectionLevel,
                    MsmqSecureHashAlgorithm = securityTransportSection.MsmqSecureHashAlgorithm
                };
                var msmqSecurityMessage = new MessageSecurityOverMsmq
                {
                    ClientCredentialType = section.Security.Message.ClientCredentialType
                };
                msmqSecurity.Message = msmqSecurityMessage;
                msmqSecurity.Transport = msmqSecurityTransport;
                binding.Security = msmqSecurity;
                if (readerQuotas != null)
                {
                    binding.ReaderQuotas = readerQuotas;
                }
                configs.Add(binding);

            }
            return configs;
        }
		public MsmqTransportSecurity (MsmqTransportSecurity other)
		{
		}