SignatureOptions Enumeration

Specifies the parts of the SOAP message that were signed for incoming SOAP messages or that will be signed for outgoing SOAP messages. This enumeration covers only a limited, known set of message parts.

Namespace: Microsoft.Web.Services2.Security
Assembly: Microsoft.Web.Services2 (in microsoft.web.services2.dll)

Usage

'Usage
Dim signatureOptions1 As SignatureOptions = SignatureOptions.IncludeAction

Syntax

'Declaration
Public Enum SignatureOptions
public enum SignatureOptions
public enum class SignatureOptions
public enum SignatureOptions
public enum SignatureOptions

Example

The following code example checks whether the <Body> element of the SOAP request is signed.

[Visual Basic]
<WebMethod(), _
    SoapHeader("referencedSOAPheader", Direction:=SoapHeaderDirection.InOut)> _
Public Function EchoString(ByVal str As String) As String

    Dim context As SoapContext = RequestSoapContext.Current

    ' Determine what portion of the SOAP message was signed.
    Dim retString As String = String.Empty
    Dim secElm As ISecurityElement
    For Each secElm In context.Security.Elements

        If TypeOf secElm Is MessageSignature Then

            Dim sig As MessageSignature = CType(secElm, MessageSignature)
            ' Check if the <Body> element was signed.
            Dim bodySigned As Boolean = ((sig.SignatureOptions _
                And SignatureOptions.IncludeSoapBody) <> 0)
            retString = sig.SigningToken.Id
            ' Iterate over the non-default elements that were signed.
            Dim i As Integer
            For i = 0 To sig.SignedInfo.References.Count - 1
            Next
        End If
    Next

    Return retString

End Function

[C#]
[WebMethod]
[SoapHeader("referencedSOAPheader", Direction=SoapHeaderDirection.InOut)]
public string EchoString( String str )
{          
    SoapContext context = RequestSoapContext.Current;

    // Determine what portion of the SOAP message was signed.
    string retString = String.Empty;
    foreach (ISecurityElement secElm in context.Security.Elements)
    {
        if (secElm is MessageSignature)
        {
            MessageSignature sig = secElm as MessageSignature;
            // Check if the <Body> element was signed.
            bool bodySigned = ((sig.SignatureOptions & SignatureOptions.IncludeSoapBody) != 0);
            retString = sig.SigningToken.Id;
            // Iterate over the non-default elements that were signed.
            for(int i = 0; i < sig.SignedInfo.References.Count; i++)
            {
            }
        }
    }

    return retString;
      }

Members

Member name Description
IncludeAction The <Action> header, as described in the WS-Addressing specification, should be signed.
IncludeAddressing The <Action>, <FaultTo>, <From>, <MessageId>, <Recipient>, <RelatesTo>, <ReplyTo>, and <To> headers, as described in the WS-Addressing specification, should be signed.
IncludeFaultTo The <FaultTo> header, as described in the WS-Addressing specification, should be signed.
IncludeFrom The <From> header, as described in the WS-Addressing specification, should be signed.
IncludeMessageId The <MessageId> header, as described in the WS-Addressing specification, should be signed.
IncludeNone No part of the message should be signed.
IncludeReferenceProperties [To be supplied.]
IncludeRelatesTo The <RelatesTo> header, as described in the WS-Addressing specification, should be signed.
IncludeReplyTo The <ReplyTo> header, as described in the WS-Addressing specification, should be signed.
IncludeSoapBody The SOAP body should be signed.
IncludeTimestamp The timestamp should be signed.
IncludeTo The <To> header, as described in the WS-Addressing specification, should be signed.

Remarks

When you are trying to determine the parts of the SOAP message that were signed for incoming SOAP messages, some of the parts that were signed might not be represented using this enumeration. For example, if a custom SOAP header was signed, then that will not be covered by this enumeration. For more details about determining the portions of the SOAP message that were not signed, see How to: Determine Which Parts of a SOAP Message Were Signed or Encrypted.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, and Windows 2000

Target Platforms

Windows 2000, Windows 2000 Server, Windows 2000 Advanced Server, Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, Pocket PC, Windows CE, Smart Phone

See Also

Reference

Microsoft.Web.Services2.Security Namespace