AsymmetricSecurityBindingElement Class

Definition

Represents a custom binding element that supports channel security using asymmetric encryption. This binding element signs the message using the sender's authentication token and encrypts the message using the recipient's token.

public sealed class AsymmetricSecurityBindingElement : System.ServiceModel.Channels.SecurityBindingElement, System.ServiceModel.Description.IPolicyExportExtension
Inheritance
AsymmetricSecurityBindingElement
Implements

Examples

The following example shows how to use this class to create a custom binding that includes this class as a security binding element. For more information about the code in this example, see How to: Consistently Reference X.509 Certificates.

public Binding CreateClientBinding()
{
    AsymmetricSecurityBindingElement abe =
        (AsymmetricSecurityBindingElement)SecurityBindingElement.
        CreateMutualCertificateBindingElement(
        MessageSecurityVersion.
        WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10);

    abe.SetKeyDerivation(false);
    
    X509SecurityTokenParameters istp =
       abe.InitiatorTokenParameters as X509SecurityTokenParameters;
    if (istp != null)
    {
        istp.X509ReferenceStyle =
        X509KeyIdentifierClauseType.IssuerSerial;
    }
    X509SecurityTokenParameters rstp =
    abe.RecipientTokenParameters as X509SecurityTokenParameters;
    if (rstp != null)
    {
        rstp.X509ReferenceStyle =
        X509KeyIdentifierClauseType.IssuerSerial;
    }

    HttpTransportBindingElement transport = 
        new HttpTransportBindingElement();

    return new CustomBinding(abe, transport);
}
Public Function CreateClientBinding() As Binding
	Dim abe As AsymmetricSecurityBindingElement = CType(SecurityBindingElement.CreateMutualCertificateBindingElement(MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10), AsymmetricSecurityBindingElement)

	abe.SetKeyDerivation(False)

	Dim istp As X509SecurityTokenParameters = TryCast(abe.InitiatorTokenParameters, X509SecurityTokenParameters)
	If istp IsNot Nothing Then
		istp.X509ReferenceStyle = X509KeyIdentifierClauseType.IssuerSerial
	End If
	Dim rstp As X509SecurityTokenParameters = TryCast(abe.RecipientTokenParameters, X509SecurityTokenParameters)
	If rstp IsNot Nothing Then
		rstp.X509ReferenceStyle = X509KeyIdentifierClauseType.IssuerSerial
	End If

	Dim transport As New HttpTransportBindingElement()

	Return New CustomBinding(abe, transport)
End Function

Remarks

A custom binding contains a collection of binding elements arranged in a specific order: the element that represents the top of the binding stack is added first, the next element down in the binding stack, is added second, and so forth.

To add this class to a binding

  1. Create a BindingElementCollection.

  2. Create custom binding elements that is above this binding element in the binding stack, such as the optional TransactionFlowBindingElement and ReliableSessionBindingElement.

  3. Add the created elements in the preceding order to the BindingElementCollection using the InsertItem(Int32, BindingElement) method.

  4. Create an instance of AsymmetricSecurityBindingElement and add it to the collection.

  5. Add any additional custom binding elements to the collection, such as TcpTransportBindingElement.

Before using this class, you should determine if a standard binding meets your security requirements.

Note

Once an instance of this object is created, you should treat the properties of its base class SecurityBindingElement as immutable. Calling set on some properties may have unpredictable effects: the binding may behave as if the property retained its old value, with a run-time failure being the only indication of an issue. Two properties known to behave this way are KeyType and MessageSecurityVersion. There may be other properties this is true of.

Constructors

AsymmetricSecurityBindingElement()

Creates an instance of this class.

AsymmetricSecurityBindingElement(SecurityTokenParameters)

Initializes a new instance of AsymmetricSecurityBindingElement with the specified recipient token parameters.

AsymmetricSecurityBindingElement(SecurityTokenParameters, SecurityTokenParameters)

Initializes a new instance of AsymmetricSecurityBindingElement with the specified recipient and initiator token parameters.

Properties

AllowSerializedSigningTokenOnReply

Gets or sets a value that indicates whether serializing a signing token on a reply message is allowed.

InitiatorTokenParameters

Specifies the token definition for the initiator.

MessageProtectionOrder

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

RecipientTokenParameters

Specifies the token definition for the recipient.

RequireSignatureConfirmation

Gets or sets a value that indicates whether message signatures must be confirmed.

Methods

Clone()

Creates a new instance of this class initialized from the current one.

GetProperty<T>(BindingContext)

Gets a specified object from the BindingContext.

SetKeyDerivation(Boolean)

Sets a value that indicates whether derived keys are required.

ToString()

Returns a string that represents this AsymmetricSecurityBindingElement instance.

Equals(Object) Inherited from Object
Equals(Object, Object) Inherited from Object
GetHashCode() Inherited from Object
GetType() Inherited from Object
MemberwiseClone() Inherited from Object
ReferenceEquals(Object, Object) Inherited from Object
AllowInsecureTransport Inherited from SecurityBindingElement
BuildChannelFactory<TChannel>(BindingContext) Inherited from SecurityBindingElement
BuildChannelFactoryCore<TChannel>(BindingContext) Inherited from SecurityBindingElement
BuildChannelListener<TChannel>(BindingContext) Inherited from SecurityBindingElement
BuildChannelListenerCore<TChannel>(BindingContext) Inherited from SecurityBindingElement
CanBuildChannelFactory<TChannel>(BindingContext) Inherited from SecurityBindingElement
CanBuildChannelListener<TChannel>(BindingContext) Inherited from SecurityBindingElement
CreateAnonymousForCertificateBindingElement() Inherited from SecurityBindingElement
CreateCertificateOverTransportBindingElement() Inherited from SecurityBindingElement
CreateCertificateOverTransportBindingElement(MessageSecurityVersion) Inherited from SecurityBindingElement
CreateCertificateSignatureBindingElement() Inherited from SecurityBindingElement
CreateIssuedTokenBindingElement(IssuedSecurityTokenParameters) Inherited from SecurityBindingElement
CreateIssuedTokenForCertificateBindingElement(IssuedSecurityTokenParameters) Inherited from SecurityBindingElement
CreateIssuedTokenForSslBindingElement(IssuedSecurityTokenParameters) Inherited from SecurityBindingElement
CreateIssuedTokenForSslBindingElement(IssuedSecurityTokenParameters, Boolean) Inherited from SecurityBindingElement
CreateIssuedTokenOverTransportBindingElement(IssuedSecurityTokenParameters) Inherited from SecurityBindingElement
CreateKerberosBindingElement() Inherited from SecurityBindingElement
CreateKerberosOverTransportBindingElement() Inherited from SecurityBindingElement
CreateMutualCertificateBindingElement() Inherited from SecurityBindingElement
CreateMutualCertificateBindingElement(MessageSecurityVersion) Inherited from SecurityBindingElement
CreateMutualCertificateBindingElement(MessageSecurityVersion, Boolean) Inherited from SecurityBindingElement
CreateMutualCertificateDuplexBindingElement() Inherited from SecurityBindingElement
CreateMutualCertificateDuplexBindingElement(MessageSecurityVersion) Inherited from SecurityBindingElement
CreateSecureConversationBindingElement(SecurityBindingElement) Inherited from SecurityBindingElement
CreateSecureConversationBindingElement(SecurityBindingElement, Boolean) Inherited from SecurityBindingElement
CreateSecureConversationBindingElement(SecurityBindingElement, Boolean, ChannelProtectionRequirements) Inherited from SecurityBindingElement
CreateSslNegotiationBindingElement(Boolean) Inherited from SecurityBindingElement
CreateSslNegotiationBindingElement(Boolean, Boolean) Inherited from SecurityBindingElement
CreateSspiNegotiationBindingElement() Inherited from SecurityBindingElement
CreateSspiNegotiationBindingElement(Boolean) Inherited from SecurityBindingElement
CreateSspiNegotiationOverTransportBindingElement() Inherited from SecurityBindingElement
CreateSspiNegotiationOverTransportBindingElement(Boolean) Inherited from SecurityBindingElement
CreateUserNameForCertificateBindingElement() Inherited from SecurityBindingElement
CreateUserNameForSslBindingElement() Inherited from SecurityBindingElement
CreateUserNameForSslBindingElement(Boolean) Inherited from SecurityBindingElement
CreateUserNameOverTransportBindingElement() Inherited from SecurityBindingElement
DefaultAlgorithmSuite Inherited from SecurityBindingElement
EnableUnsecuredResponse Inherited from SecurityBindingElement
EndpointSupportingTokenParameters Inherited from SecurityBindingElement
IncludeTimestamp Inherited from SecurityBindingElement
KeyEntropyMode Inherited from SecurityBindingElement
LocalClientSettings Inherited from SecurityBindingElement
LocalServiceSettings Inherited from SecurityBindingElement
MessageSecurityVersion Inherited from SecurityBindingElement
OperationSupportingTokenParameters Inherited from SecurityBindingElement
OptionalEndpointSupportingTokenParameters Inherited from SecurityBindingElement
OptionalOperationSupportingTokenParameters Inherited from SecurityBindingElement
ProtectTokens Inherited from SecurityBindingElement
SecurityHeaderLayout Inherited from SecurityBindingElement
SetIssuerBindingContextIfRequired(SecurityTokenParameters, BindingContext) Inherited from SecurityBindingElement

Explicit Interface Implementations

IPolicyExportExtension.ExportPolicy(MetadataExporter, PolicyConversionContext)

Exports a custom policy assertion about bindings, which is added to the Web Services Description Language (WSDL) information.

Applies to