MessageProtectionOrder 列挙型
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
メッセージを保護する操作の順序を指定します。
public enum class MessageProtectionOrder
public enum MessageProtectionOrder
type MessageProtectionOrder =
Public Enum MessageProtectionOrder
- 継承
フィールド
| 名前 | 値 | 説明 |
|---|---|---|
| SignBeforeEncrypt | 0 | SOAP メッセージの一部が暗号化される前に、SOAP メッセージのデジタル署名が生成されますが、デジタル署名は暗号化されないことを指定します。 |
| SignBeforeEncryptAndEncryptSignature | 1 | SOAP メッセージの一部を暗号化し、デジタル署名を暗号化する前に、SOAP メッセージのデジタル署名を生成することを指定します。 |
| EncryptBeforeSign | 2 | SOAP メッセージのデジタル署名が生成される前に SOAP メッセージを暗号化することを指定します。 |
例
次の例では、 SymmetricSecurityBindingElement 要素を作成し、その MessageProtectionOrder プロパティを SignBeforeEncrypt に設定します。
public static Binding CreateCustomBinding()
{
// Create an empty BindingElementCollection to populate,
// then create a custom binding from it.
BindingElementCollection outputBec = new BindingElementCollection();
// 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;
// Use a Kerberos token as the protection token.
ssbe.ProtectionTokenParameters = new KerberosSecurityTokenParameters();
// Add the SymmetricSecurityBindingElement to the BindingElementCollection.
outputBec.Add ( ssbe );
outputBec.Add(new TextMessageEncodingBindingElement());
outputBec.Add(new HttpTransportBindingElement());
// Create a CustomBinding and return it; otherwise, return null.
return new CustomBinding(outputBec);
}
Public Shared Function CreateCustomBinding() As Binding
' Create an empty BindingElementCollection to populate,
' then create a custom binding from it.
Dim outputBec As New BindingElementCollection()
' Create a SymmetricSecurityBindingElement.
Dim ssbe As 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
' Use a Kerberos token as the protection token.
ssbe.ProtectionTokenParameters = New KerberosSecurityTokenParameters()
' Add the SymmetricSecurityBindingElement to the BindingElementCollection.
outputBec.Add(ssbe)
outputBec.Add(New TextMessageEncodingBindingElement())
outputBec.Add(New HttpTransportBindingElement())
' Create a CustomBinding and return it; otherwise, return null.
Return New CustomBinding(outputBec)
End Function
注釈
この列挙型は、AsymmetricSecurityBindingElementのAsymmetricSecurityBindingElement.MessageProtectionOrder プロパティと、SymmetricSecurityBindingElement クラスのSymmetricSecurityBindingElement.MessageProtectionOrder プロパティと共に使用されます。
メッセージがダイジェスト攻撃に対して脆弱な場合 (たとえば、メッセージが短い場合やエントロピが低い場合)、SignBeforeEncryptAndEncryptSignature または EncryptBeforeSign オプションを使用する必要があります。 (エントロピ は、サーバー、クライアント、またはその両方によって提供されるランダム なデータであり、データを暗号化および復号化するための共有キーを作成するために使用されます)。
注文内容
WCF には、SOAP メッセージ セキュリティを使用してメッセージをセキュリティで保護する方法を決定する 3 つの異なる保護レベルが用意されています。 既定値は SignBeforeEncryptAndEncryptSignature です。 この設定では、最初にメッセージに署名し、メッセージ本文を暗号化してから、XML 署名を暗号化します。 これにより、署名に対する暗号推測攻撃が成功する可能性が低くなります。
ただし、既定値を使用すると、パフォーマンスに影響があります。 実際には、セキュリティを強化するためのパフォーマンスのトレードオフがあります。 署名を暗号化すると、10% から 40% の間でパフォーマンスが低下する可能性があります。 メッセージのデータコンテンツが低い値であり、パフォーマンススループットがより重要な場合は、SignBeforeEncrypt を使用します。 この設定では、署名ダイジェストがクリア テキストで送信されるため、メッセージは低エントロピに対する推測および検証攻撃に対して脆弱になります。
カスタム バインドのみ
MessageProtectionOrder プロパティを変更するには、カスタム セキュリティ バインディングを作成する必要があります。 カスタム バインドの作成の詳細については、「 User-Defined バインドの作成」を参照してください。 特定の認証モードのカスタム バインドを作成する方法の詳細については、「 方法: 指定された認証モードの SecurityBindingElement を作成する」を参照してください。