Export (0) Print
Expand All

MailSecurityMode Enumeration

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Defines whether SOAP message security is enabled.

Namespace:  Microsoft.ServiceModel.Channels.Mail
Assembly:  Microsoft.ServiceModel.Channels.Mail (in Microsoft.ServiceModel.Channels.Mail.dll)

public enum MailSecurityMode

Member nameDescription
Supported by the .NET Compact FrameworkNoneSOAP message security is disabled. This is the default value.
Supported by the .NET Compact FrameworkMessageSOAP message security is enabled.

By default, the mail binding sets SOAP message security to MailSecurityMode.None, which disables SOAP message security.

When SOAP message security is enabled, the mail binding uses an AsymmetricSecurityBindingElement. SOAP message security for the mail transport is based on X.509 certificates. The default values for AsymmetricSecurityBindingElement properties are as follows:

  • MessageSecurityVersion = MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10

  • SecurityHeaderLayout = SecurityHeaderLayout.Lax

  • MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt

  • IncludeTimestamp = true

  • SecurityBindingElement.LocalServiceSettings.TimestampValidityDuration = 24 hours.

  • SecurityBindingElement.LocalClientSettings.TimestampValidityDuration = 24 hours.

For device-based applications, the following default settings are also used:

  • SecurityBindingElement.LocalClientSettings.DetectReplays = false

  • SecurityBindingElement.LocalServiceSettings.DetectReplays = false

For desktop applications, the following default settings are also used:

  • SecurityBindingElement.LocalClientSettings.ReplayWindow = 24 hours

  • SecurityBindingElement.LocalServiceSettings.ReplayWindow = 24 hours

  • System.ServiceModel.Channels.AsymmetricSecurityBindingElement.InitiatorTokenParameters.RequireDerivedKeys = false

  • System.ServiceModel.Channels.AsymmetricSecurityBindingElement.RecipientTokenParameters.RequireDerivedKeys = false

If you need to change the default SOAP message security, you can instantiate all binding elements and pass them to the constructor for a CustomBinding object instead of using a class that is derived from the MailBindingBase object. Alternatively, you can call the CreateBindingElements method to return the binding elements, change the value on specific binding elements, and then pass the binding elements to a CustomBinding object.

The following example shows how to enable message security for the mail binding. For the complete code example, see the MailSecurity class.


ExchangeWebServiceMailBinding binding;
Uri clientEmailServer = new Uri("http://mail.example.com");
string clientEmailAddress = "client@example.com";
string password = "password";

binding = new ExchangeWebServiceMailBinding(clientEmailServer,
                                           new NetworkCredential(clientEmailAddress, password));
binding.Security.Mode = MailSecurityMode.Message;


Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Compact Framework

Supported in: 3.5
Show:
© 2014 Microsoft