Adding the nonce for confidentiality to generator security constraints with keywords

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 non-secure 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 to specify a nonce for confidentiality using keywords 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.

  1. 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 you 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 you 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 Confidentiality section. Confidentiality refers to encryption while 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.

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

    1. Specify a name for the confidentiality element in the Confidentiality Name field. For example, you might specify conf_nonce.

    2. 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 encyrption is done first.

  6. Under Nonce, click Add and select the Nonce dialect. The http://www.ibm.com/websphere/webservices/wssecurity/dialect-was dialect specifies the message part to which a nonce is added and encrypted. If you select this dialect, you can select one of the following keywords under Nonce keyword:

    bodycontent

    Specifies the user data portion of the message. If this keyword is selected, the nonce is embedded in the Simple Object Access Protocol (SOAP) message body and the body is encrypted.

    usernametoken

    Specifies a username token that contains the basic authentication information such as a user name and a password. Usually, the username token is encrypted so that the user information is secure. If you select this keyword, the nonce element is embedded in the username token element and it is encrypted.

    digestvalue

    Specifies a unique digest value. When a part of the SOAP message is signed, a unique digest value is created and is used by the receiving party to check the integrity of the message. You can encrypt the digestvalue element to secure the digest value. If you select this keyword, the nonce is embedded in the digestvalue element and the element is encrypted.

  7. In the Message Parts section, click Add and select http://www.ibm.com/websphere/webservices/wssecurity/dialect-was 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 Message Parts section in order to specify a nonce for confidentiality. When you select the message part, you are encrypting the message part in addition to the parent element of the nonce.

  9. Click OK to save the configuration changes.

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

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

The following example is a part of a SOAP message where a nonce is inserted into the bodycontent element and it is encrypted using the bodycontent keyword and the http://www.ibm.com/websphere/webservices/wssecurity/dialect-was dialect.

Important: You cannot see the nonce in the message because it is encrypted.

<soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <EncryptedData Id="wssecurity_encryption_id_1669600751905274321" 
    Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns="http://www.w3.org/2001/04/xmlenc#">
      <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
      <CipherData>
         <CipherValue>pZpVL6Rs6zhvu8UrC7TH3BA2zvOdpPpLeHnwH0dCpmdc7ETz1tUHDdXLFxy143nYu91Mxpzsp
          Wt1rWx2Lx9vFGRIfblRSX5lEpV8+0LvezvhJYY/cbTA04mTMUzCfv28v2TI09AZQ4TjII4u+cPeh5f0prBVK1
          E5hLTql4QMcwf/rq9h+tttrJbR7ub3AUgIVo42ucQs5HZbaDijxmdSuFboBql4lv1Ep24ZfeoB/p7aHzyeWy7p
          YtO0bshpks/oBwO/78vxSklVJKu4sUseFvZa+B7sciFneeNnNuRCqB2JXc/vtH83l3AELUZg60ehd4vqvXkyuv
          SLohZ/kKnF/A5c+BP5Bo1pgvwmDEeJItQ5a7LOKkTavLuc2WGtVo1947fnNGm2TN4C6U/cp9ERT7jAB9Lr/1v/8
          ZqPZYmssyME4pGeSWLy232WrPvk6HEu96GHfRt+YXWpVNvSEt/gZw==</CipherValue>        </CipherData>
   </EncryptedData>
</soapenv:Body>

After you specify which message parts to encrypt, specify which method is used to encrypt the message. For more information, see Configuring encryption information for the generator binding.

 

Related concepts

XML digital signature

 

Related tasks

Adding time stamps for confidentiality to generator security constraints with keywords

Adding time stamps for confidentiality to generator security constraints with an XPath expression

Configuring encryption information for the generator binding