Adding a nonce for integrity to generator security constraints with an XPath expression

 

Before you begin

Prior to completing this task, import your application into an assembly tool. For information on how to import your application, see Import enterprise applications.

The following information explains the difference between using an XPath expression and using keywords to specify which part of the message to sign:

XPath expression

Specify any part of the message using an XPath expression. XPath is a language that is used to address parts of an XML document. We can find information on XPath syntax at the following Web site: http://www.w3.org/TR/1999/REC-xpath-19991116.

Keywords

Specify only elements within the message using predefined keywords.

 

Overview

Nonce for integrity is used to specify that the nonce is embedded in a particular element and the element is signed. Nonce is a randomly generated, cryptographic token. When nonce is added to the specific parts of a message, it might prevent theft and replay attacks because a generated nonce is unique. For example, without nonce, when a user name token is passed from one machine to another machine using a non-secure transport, such as HTTP, the token might be intercepted and used in a replay attack. The user name token can be stolen even if you use XML digital signature and XML encryption. However, it might be prevented by adding a nonce.

Complete the following steps to specify a nonce for integrity using an XPath expression when you configure the generator security constraints for either the request generator or the response generator. The request generator is configured for the client and the response generator is configured for the server. In the following steps, configure either the client-side extensions in step 2 or the server-side extensions in step 3.

 

Procedure

  1. Start the assembly tool and click Window > Open Perspective > J2EE.

  2. Optional: Locate the client-side extensions using the Project Explorer window. The Client Deployment Descriptor window is displayed. This Web service contains the extensions that we need to configure. Complete the following steps to locate the client-side extensions:

    1. Expand the Web Services > Client section and double-click the name of the Web service.

    2. Click the WS Extension tab and expand the Request Generator Configuration section.

  3. Optional: Locate the server-side extensions using the Project Explorer window. The Web Services Editor window is displayed. This Web service contains the extensions that we need to configure. Complete the following steps to locate the server-side extensions:

    1. Expand the Web Services > Services section and double-click the name of the Web service.

    2. Click the Extensions tab and expand the Response Generator Service Configuration Details section.

  4. Expand the Integrity section. Integrity refers to digital signature while confidentiality refers to encryption. Integrity decreases the risk of data modification when you transmit data across a network. For more information on digitally signing SOAP messages, see XML digital signature.

  5. Click Add to specify a nonce for integrity. The Integrity Dialog window is displayed. Complete the following steps to specify a configuration:

    1. Specify a name for the integrity element in the Integrity Name field.

    2. Specify an order in the Order field. The value, which must be a positive integer value, specifies the order in which the digital signature is processed. An order value of 1 specifies that the signing is done first.

  6. Click Add in the Nonce section of the Integrity Dialog window. Complete the following steps to specify a nonce dialect and message part:

    1. Select the Nonce dialect from the Nonce section. The http://www.w3.org/TR/1999/REC-xpath-19991116 dialect specifies the message part to which a nonce is added and signed using an XPath expression.

    2. Select the message part in the Nonce keyword field to which a nonce is added and signed using an XPath expression. For example, to specify that a nonce is added to the body and that it is signed, you might specify the following expression for the Nonce keyword

      /*[namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/' 
      and local-name()='Envelope']/*[namespace-uri()='http://schemas.xmlsoap.org/
      soap/envelope/' and local-name()='Body']
      

  7. In the Message Parts section, click Add and select http://www.w3.org/TR/1999/REC-xpath-19991116 in the Message parts dialect field.

  8. In the Message Parts section, select the message parts keyword. Important: You must define at least one message part in the Message Parts section in order to specify a nonce for integrity. This message part is signed as well as the parent element of the nonce.

  9. Click OK to save the configuration changes.

    Note: These configurations for the consumer and the generator must match.

    In addition to the nonce, one can specify that the timestamp element is signed. For more information, see the following articles:

 

What to do next

After you specify that a nonce is added to the message parts and signed, specify which method is used to digitally sign the message. For more information, see Configuring signing information for the generator binding with an assembly tool.


 

See Also


XML digital signature

 

Related Tasks


Adding time stamps for integrity to generator security constraints with keywords
Adding time stamps for integrity to generator security constraints with an XPath expression
Configuring signing information for the generator binding with an assembly tool