This documentation is archived and is not being maintained.

SymmetricSecurityBindingElement.MessageProtectionOrder Property

Gets or sets the order of message encryption and signing for this binding.

Namespace: System.ServiceModel.Channels
Assembly: System.ServiceModel (in system.servicemodel.dll)

public MessageProtectionOrder MessageProtectionOrder { get; set; }
/** @property */
public MessageProtectionOrder get_MessageProtectionOrder ()

/** @property */
public void set_MessageProtectionOrder (MessageProtectionOrder value)

public function get MessageProtectionOrder () : MessageProtectionOrder

public function set MessageProtectionOrder (value : MessageProtectionOrder)

Not applicable.

Property Value

The MessageProtectionOrder that specifies how the message is protected. The default is SignBeforeEncrypt.

Exception typeCondition


set and value is undefined.


If there is nothing in the message that is encrypted, the signature element is not encrypted even when the MessageProtectionOrder property is set to SignBeforeEncryptAndEncryptSignature. This behavior occurs even with system-provided bindings. However, the WSDL generated by WCF still contains the <sp:EncryptSignature> assertion.

For a listing of the members and their descriptions, see MessageProtectionOrder.

The following code shows how to set this property.

// Create a SymmetricSecurityBindingElement.
SymmetricSecurityBindingElement ssbe = 
    new SymmetricSecurityBindingElement();

// Set the algorithm suite to one that uses 128-bit keys.
ssbe.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128;

   // Set MessageProtectionOrder to SignBeforeEncrypt.
ssbe.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt;

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0