SymmetricSecurityBindingElement.MessageProtectionOrder 属性

定义

获取或设置此绑定的消息加密和签名的顺序。Gets or sets the order of message encryption and signing for this binding.

public:
 property System::ServiceModel::Security::MessageProtectionOrder MessageProtectionOrder { System::ServiceModel::Security::MessageProtectionOrder get(); void set(System::ServiceModel::Security::MessageProtectionOrder value); };
public System.ServiceModel.Security.MessageProtectionOrder MessageProtectionOrder { get; set; }
member this.MessageProtectionOrder : System.ServiceModel.Security.MessageProtectionOrder with get, set
Public Property MessageProtectionOrder As MessageProtectionOrder

属性值

用于指定如何保护消息的 MessageProtectionOrderThe MessageProtectionOrder that specifies how the message is protected. 默认值为 SignBeforeEncryptThe default is SignBeforeEncrypt.

异常

未定义 setvalueset and value is undefined.

示例

下面的代码演示如何设置此属性。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;

注解

备注

如果加密的消息中没有任何内容,则不会对签名元素进行加密,即使当 MessageProtectionOrder 属性设置为 SignBeforeEncryptAndEncryptSignature 也是如此。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. 不过, WCF 生成的 WSDL 仍包含<sp:EncryptSignature>断言。However, the WSDL generated by WCF still contains the <sp:EncryptSignature> assertion.

有关成员及其说明的列表,请参见 MessageProtectionOrderFor a listing of the members and their descriptions, see MessageProtectionOrder.

适用于