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; }
static bool TryCreateSecurity(SecurityBindingElement sbe, UnifiedSecurityMode mode, out NetMsmqSecurity security) { if (sbe != null) { mode &= UnifiedSecurityMode.Message | UnifiedSecurityMode.Both; } else { mode &= ~(UnifiedSecurityMode.Message | UnifiedSecurityMode.Both); } NetMsmqSecurityMode netMsmqSecurityMode = NetMsmqSecurityModeHelper.ToSecurityMode(mode); Fx.Assert(NetMsmqSecurityModeHelper.IsDefined(netMsmqSecurityMode), string.Format("Invalid NetMsmqSecurityMode value: {0}.", netMsmqSecurityMode.ToString())); if (NetMsmqSecurity.TryCreate(sbe, netMsmqSecurityMode, out security)) { return(true); } return(false); }