public SecurityAppliedMessage(Message messageToProcess, SendSecurityHeader securityHeader, bool signBody, bool encryptBody) : base(messageToProcess) { Fx.Assert(!(messageToProcess is SecurityAppliedMessage), "SecurityAppliedMessage should not be wrapped"); this.securityHeader = securityHeader; this.bodyProtectionMode = MessagePartProtectionModeHelper.GetProtectionMode(signBody, encryptBody, securityHeader.SignThenEncrypt); }
private MessagePartProtectionMode GetProtectionMode(MessageHeader header) { if (!RequireMessageProtection) { return(MessagePartProtectionMode.None); } bool sign = _signedXml != null && _effectiveSignatureParts.IsHeaderIncluded(header); bool encrypt = false; return(MessagePartProtectionModeHelper.GetProtectionMode(sign, encrypt, SignThenEncrypt)); }