AsymmetricSecurityBindingElement Class
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.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
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
Create a BindingElementCollection.
Create custom binding elements that is above this binding element in the binding stack, such as the optional TransactionFlowBindingElement and ReliableSessionBindingElement.
Add the created elements in the preceding order to the BindingElementCollection using the InsertItem(Int32, BindingElement) method.
Create an instance of AsymmetricSecurityBindingElement and add it to the collection.
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. |
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: Reference X.509 Certificates Consistently.
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); }
System.ServiceModel.Channels.BindingElement
System.ServiceModel.Channels.SecurityBindingElement
System.ServiceModel.Channels.AsymmetricSecurityBindingElement
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, 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.
Note: