Compartilhar via


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)

Syntax

'Declaration
Public Enumeration MailSecurityMode
'Usage
Dim instance As MailSecurityMode
public enum MailSecurityMode
public enum class MailSecurityMode
type MailSecurityMode

Members

Member name Description
Supported by the .NET Compact Framework None SOAP message security is disabled. This is the default value.
Supported by the .NET Compact Framework Message SOAP message security is enabled.

Remarks

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.

Examples

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

Dim binding As ExchangeWebServiceMailBinding
Dim clientEmailServer As New Uri("https://mail.example.com")
Dim clientEmailAddress As String = "client@example.com"
Dim password As String = "password"

binding = New ExchangeWebServiceMailBinding(clientEmailServer, New NetworkCredential(clientEmailAddress, password))
binding.Security.Mode = MailSecurityMode.Message
ExchangeWebServiceMailBinding binding;
Uri clientEmailServer = new Uri("https://mail.example.com");
string clientEmailAddress = "client@example.com";
string password = "password";

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

Platforms

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.

Version Information

.NET Compact Framework

Supported in: 3.5

See Also

Reference

Microsoft.ServiceModel.Channels.Mail Namespace