Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-761

Add method to set digest algorithm for signature (WSS4J)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.5
    • Component/s: Security
    • Labels:
      None

      Description

      I wanted to change the digest algorithm which is used for signatures in secured SOAP Messages (default is SHA1). WSS4J supports this, but it seems this is not included in the Wss4jSecurityInterceptor facade (2.0.4.RELEASE) from Spring WS Security.
      The constant "org.apache.ws.security.handler.WSHandlerConstants .SIG_DIGEST_ALGO" allows it to set the digest algorithm which is used in WSS signatures.

      I patched the following code into the Wss4jSecurityInterceptor class and was then able to change the digest algorithm:

      public void setSecurementSignatureDigestAlgorithm(String digestAlgo) {
          handler.setOption(WSHandlerConstants.SIG_DIGEST_AL GO, digestAlgo);
      }

      Context XML:

      <bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j. Wss4jSecurityInterceptor">
      .. snip ..
         <property name="securementSignatureDigestAlgorithm" value="http://www.w3.org/2001/04/xmlenc#sha256"/>
      </bean>

        Activity

        oliverm Oliver Mihatsch created issue -
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Assignee Arjen Poutsma [ arjen.poutsma ]
        arjen.poutsma Arjen Poutsma made changes -
        Fix Version/s 2.0.5 [ 12848 ]
        arjen.poutsma Arjen Poutsma made changes -
        Description I wanted to change the digest algorithm which is used for signatures in secured SOAP Messages (default is SHA1). WSS4J supports this, but it seems this is not included in the Wss4jSecurityInterceptor facade (2.0.4.RELEASE) from Spring WS Security.
        The constant "org.apache.ws.security.handler.WSHandlerConstants .SIG_DIGEST_ALGO" allows it to set the digest algorithm which is used in WSS signatures.

        I patched the following code into the Wss4jSecurityInterceptor class and was then able to change the digest algorithm:

        public void setSecurementSignatureDigestAlgorithm(String digestAlgo) {
            handler.setOption(WSHandlerConstants.SIG_DIGEST_AL GO, digestAlgo);
        }

        Context XML:
        <bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j. Wss4jSecurityInterceptor">
        .. snip ..
           <property name="securementSignatureDigestAlgorithm" value="http://www.w3.org/2001/04/xmlenc#sha256"/>
        </bean>
        I wanted to change the digest algorithm which is used for signatures in secured SOAP Messages (default is SHA1). WSS4J supports this, but it seems this is not included in the Wss4jSecurityInterceptor facade (2.0.4.RELEASE) from Spring WS Security.
        The constant "org.apache.ws.security.handler.WSHandlerConstants .SIG_DIGEST_ALGO" allows it to set the digest algorithm which is used in WSS signatures.

        I patched the following code into the Wss4jSecurityInterceptor class and was then able to change the digest algorithm:

        {code}
        public void setSecurementSignatureDigestAlgorithm(String digestAlgo) {
            handler.setOption(WSHandlerConstants.SIG_DIGEST_AL GO, digestAlgo);
        }
        {code}

        Context XML:
        {code:xml}
        <bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j. Wss4jSecurityInterceptor">
        .. snip ..
           <property name="securementSignatureDigestAlgorithm" value="http://www.w3.org/2001/04/xmlenc#sha256"/>
        </bean>
        {code}
        arjen.poutsma Arjen Poutsma made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        arjen.poutsma Arjen Poutsma made changes -
        Time Spent 0.05h [ 180 ]
        Worklog Id 28634 [ 28634 ]
        arjen.poutsma Arjen Poutsma made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Complete [ 8 ]
        arjen.poutsma Arjen Poutsma made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            oliverm Oliver Mihatsch
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - Not Specified
              Not Specified
              Logged:
              Time Spent - 0.05h
              0.05h