You can specify a nonce for confidentiality by 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.
Before you begin
Prior to completing this task, you must import your application into
an assembly tool.
For information on how to import your application, see Importing 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. You 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.
About this task
Nonce for confidentiality is used to specify that the nonce is
embedded in a particular element within the message and that the element is
encrypted. Nonce is a randomly generated, cryptographic token. When you add
a nonce to a specific part of a message, it can prevent theft and replay attacks
because a generated nonce is unique. For example, without a nonce, the token
might be intercepted and used in a replay attack when a user name token is
passed from one machine to another machine using a nonsecure transport, such
as HTTP. The user name token can be stolen even if you use XML digital signature
and XML encryption. This situation might be prevented by adding a nonce.
Complete
the following steps. You must configure either the client-side extensions
in step 2 or the server-side extensions in step 3.
Procedure
- Start the assembly tool.
- Switch to the Java 2 Platform, Enterprise Edition (J2EE) perspective.
Click Window > Open Perspective > J2EE.
- 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 you must configure.
Complete the following steps to locate the client-side extensions:
- Expand the Web Services > Client section and double-click the
name of the Web service.
- Click the WS Extension tab and expand the Request Generator
Configuration section.
- 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 you must configure. Complete
the following steps to locate the server-side extensions:
- Expand the Web Services > Services section and double-click
the name of the Web service.
- Click the Extensions tab and expand the Response Generator
Service Configuration Details section.
- Expand the Confidentiality section. Confidentiality
refers to encryption and integrity refers to digital signing. Confidentiality
reduces the risk of someone intercepting the message as it moves across a
network. With confidentiality specifications, the message is encrypted before
it is sent and decrypted when it is received at the intended target. For more
information on encryption, see XML encryption.
- Click Add to specify a nonce for integrity. The
Confidentiality Dialog window is displayed. Complete the following steps to
specify a configuration:
- Specify a name for the confidentiality element in the Confidentiality
Name field. For example, you might specify conf_nonce.
- Specify an order in the Order field. The value, which
must be a positive integer value, specifies the order in which the encryption
is processed. An order value of 1 specifies that the encryption is done first.
- Click Add under the Nonce section of the Confidentiality
Dialog window. Complete the following steps to specify the none
dialect and the message part:
- 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 encrypted using an
XPath expression.
- Specify the message part to which a nonce is added and encrypted
using an XPath expression in the Nonce keyword field. For example,
to specify that a nonce is added to the bodycontent element and it is encrypted,
you might add the following expression in the Nonce keyword field as one continuous
line:
/*[namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/'
and local-name()='Envelope']/*[namespace-uri()='http://schemas.xmlsoap.org/
soap/envelope/' and local-name()='Bodycontent']
- In the Message Parts section, click Add and select http://www.w3.org/TR/1999/REC-xpath-19991116
in the Message parts dialect field.
- In the Message Parts section, select the message parts keyword.
Important: You must define at least one message part in
the Message Parts section to specify nonce for Confidentiality. The selection
of message part here is for encrypting a message part in addition to the parent
element of the nonce.
- Click OK to save the configuration changes.
Note: These
configurations for the consumer and the generator must match.
In
addition to the nonce, you can specify that the timestamp element is signed.
For more information, see the following articles: