Signing message elements 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

Complete the following steps to specify which message parts to digitally sign 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 indicate which parts of the message to sign. The Integrity Dialog window is displayed.

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

    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 under the Message Parts section and select the Message parts dialect. The http://www.ibm.com/websphere/webservices/wssecurity/dialect-was dialect specifies the message part that is signed using keywords. If you select this dialect, one can select one of the following keywords under the Message parts keyword heading:

    body

    Specifies the user data portion of the message. If you select this keyword, the body is signed.

    timestamp

    Specifies that the stand-alone timestamp element within the message is signed. The timestamp element determines whether the message is valid based upon the time that the message is sent and then received. If the timestamp option is selected, make sure that there is a stand-alone timestamp element in the message. If the element does not exist, see Adding a stand-alone time stamp to generator security constraints.

    securitytoken

    Specifies that the UsernameToken in the SOAP message is signed.

    dsigkey

    Specifies that the key information element, which is used for digital signature, is signed.

    enckey

    Specifies that the key information element, which is used for encryption, is signed.

    messageid

    Specifies that the <wsa:MessageID> element within the message is signed.

    to

    Specifies that the <wsa:To> element within the message is signed.

    action

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

    relatesto

    Specifies that the <wsa:RelatesTo> element within the message is signed.

  7. Click OK to save the configuration changes.

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

    In addition to the message parts, you also can specify that WebSphere Application Server sign the nonce and timestamp elements. For more information, see the following articles:

 

Example

The following example is a SOAP message whose body is signed using the body keyword and the http://www.ibm.com/websphere/webservices/wssecurity/dialect-was dialect:

<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_956396521418196" xmlns:wsu="http://docs.oasis-open.org/
          wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> MA0GCSqGSIb3DQEBBQUAA4
          GBAHkthdGDgCvdIL9/vXUo74xpfOQd/rr1owBmMdb1TWdOyzwbOHC7lkUlnKrkI7SofwSLSDUP571ii
          MXUx3tRdmAVCoDMMFuDXh9V7212luXccx0s1S5KN0D3xW97LLNegQC0/b+aFD8XKw2U5ZtwbnFTRgs097
          dmz09RosDKkLlM
         </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_5945817517184298591">
                  <ds:Transforms>
                     <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <ec:InclusiveNamespaces PrefixList="p896 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>vyu0JwXXSAvRCUCi6TPkeH8yUTU=</ds:DigestValue>
               </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>dtbYA609wwAUAA8BmDmJlVHrWShy6OLJB3n4A6ToU0lI9tJrNhBksGqks17
             cykf+uHTJcgOY18XrRDN4wHTW4zm/tmD5WqQd8K1WpYaGpbwlFoiwKVFNyfQn2K/WbZ2JccmZvJGF
             aOtqStg6TqSUGLQSA5MCSpZUhck545IY2F4=
            </ds:SignatureValue>
            <ds:KeyInfo>
               <wsse:SecurityTokenReference>
                  <wsse:Reference URI="#x509bst_956396521418196" 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_5945817517184298591" xmlns:wsu="http://docs.oasis-open.org/
    wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <p896:getVxmlns:p896="http://msgsec.wssecfvt.ws.ibm.com"/>
   </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 generator binding with an assembly tool.

 

See also


Adding time stamps for integrity to generator security constraints with keywords
Adding a nonce for integrity in generator security constraints with keywords

 

See Also


XML digital signature

 

Related Tasks


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