Adding a nonce for integrity in generator security constraints with keywords

 

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.

 

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 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.

 

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.

    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.

    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.

    1. Specify a name for the integrity element in the Required Integrity Name field. For example, you might specify int_nonce.

    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. 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 signed. If you select this dialect, one can select one of the following keywords under Nonce keyword:

    body

    Specifies the user data portion of the message. If this option is selected, a nonce is embedded in the SOAP body element and the body element is signed.

    timestamp

    Specifies that the nonce is embedded in the stand-alone timestamp element within the message and the element is signed. If timestamp is selected, make sure that there is a stand-alone timestamp element in the message. If not, see Adding a stand-alone time stamp to generator security constraints.

    securitytoken

    Specifies that the securitytoken element is signed. The security token authenticates the client. If this option is selected, the nonce element is embedded in the securitytoken element.

    dsigkey

    Specifies that the nonce is inserted into the key information element, which is used for digital signature, and the key information element is signed.

    enckey

    Specifies that the nonce is inserted into the key information element, which is used for encryption, and the key information element is signed.

    messageid

    Specifies that the nonce is inserted into the <wsa:MessageID> element and that the <wsa:MessageID> element is signed.

    to

    Specifies that the nonce is inserted into the <wsa:To> element within the message and that the <wsa:To> element is signed.

    action

    Specifies that the <wsa:Action> element is signed.

    relatesto

    Specifies that the nonce is inserted into the <wsa:RelatesTo> element within the message and that the <wsa:RelatesTo> element is signed.

  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 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 on the consumer side and the generator side must match.

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

 

Example

The following example is a SOAP message that has a nonce that is inserted in the SOAP message body and signed:

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/
       wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/
          oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType=
          "http://docs.oasis-open.org/wss/2004/01/
          oasis-200401-wss-x509-token-profile-1.0#X509v3" 
          wsu:Id="x509bst_1179110083179840266" xmlns:wsu="http://docs.oasis-open.org/
          wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> E21hcnV5YW1hQGpwLmlib
          S5jb22CAgEBMA0GCSqGSIb3DQEBBQUAA4GBAHkthdGDgCvdIL9/vXUo74xpfOQd/rr1owBmMdb1TWdO
          yzwbOHC7lkUlnKrkI7SofwSLSDUP571iiMXUx3tRdmAVCoDMMFuDXh9V7212luXccx0s1S5KN0D3xW9
          7LLNegQC0/b+aFD8XKw2U5ZtwbnFTRgs097dmz09RosDKkLlM
         </wsse:BinarySecurityToken>
         <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <ds:SignedInfo>
               <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces PrefixList="wsse ds xsi soapenc xsd soapenv " 
                   xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
               </ds:CanonicalizationMethod>
               <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
               <ds:Reference URI="#wssecurity_signature_id_8451968259110349556">
                  <ds:Transforms>
                     <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <ec:InclusiveNamespaces PrefixList="xsi soapenc xsd wsu soapenv " 
                         xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                     </ds:Transform>
                  </ds:Transforms>
                  <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                  <ds:DigestValue>HgfL7FiG/TGECE/L0zg5mJldfgc=</ds:DigestValue>
               </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>iE2G53VMwCFBI6BwOWiaOLYvemZUJTXJocXpy8loyW1LiR8bBQcFioDOuD
             XXzVj3K+ZD2pYhc0krVYqkYY0IZoRx7xpWt+9qn7aSbxKjuHlMFNCdB1Uxp608zCZcSwvuoCffjl
             O0ltUQ8JTEBnmMB0cfaoiG5bFkUOEpkFo2P9c=</ds:SignatureValue>
            <ds:KeyInfo>
               <wsse:SecurityTokenReference>
                  <wsse:Reference URI="#x509bst_1179110083179840266" ValueType="
                   http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-
                   token-profile-1.0#X509v3"/>
               </wsse:SecurityTokenReference>
            </ds:KeyInfo>
         </ds:Signature>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
    wsu:Id="wssecurity_signature_id_8451968259110349556" xmlns:wsu="http://docs.oasis-open.org/
    wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <getVersion/>
      <wsse:Nonce wasextention="wedsig" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/
       oasis-200401-wss-wssecurity-secext-1.0.xsd">1u0otbnjkPiCWDhh25yEyBHD/r3VPSbQ1oZTs0K
       s1GE/iDL4YbKDTwdL+e2Hb7nNZn397nRJQ9ePGgf7PRdEuqATFbfq0/T+6j6Fk/MbSHmZnHHoBscFX8W/dY
       ssyCmWDp99447kRhnJbNg5JxarkFmMLqpxKfm1iP3hKP5DpJY=</wsse:Nonce>
   </soapenv:Body>
</soapenv:Envelope>

 

What to do next

After you specify which message parts to digitally sign, specify which method is used to digitally sign the message. For more information, see Configuring signing information for the consumer binding with an assembly tool.


 

See Also


XML digital signature

 

Related Tasks


Adding a stand-alone time stamp in consumer security constraints
Adding time stamps for integrity in consumer security constraints with keywords
Adding time stamps for integrity in consumer security constraints with an XPath expression
Adding a nonce for integrity in consumer security constraints with an XPath expression
Configuring signing information for the consumer binding with an assembly tool