Class WSSecDKSign


public class WSSecDKSign extends WSSecDerivedKeyBase
Builder to sign with derived keys
Author:
Ruchith Fernando (ruchith.fernando@gmail.com), Davanum Srinivas (dims@yahoo.com), Werner Dittmann (werner@apache.org)
  • Field Details

    • sigAlgo

      protected String sigAlgo
    • canonAlgo

      protected String canonAlgo
    • signatureValue

      protected byte[] signatureValue
  • Constructor Details

    • WSSecDKSign

      public WSSecDKSign()
  • Method Details

    • build

      public Document build(Document doc, WSSecHeader secHeader) throws WSSecurityException, org.apache.ws.security.conversation.ConversationException
      Throws:
      WSSecurityException
      org.apache.ws.security.conversation.ConversationException
    • prepare

      public void prepare(Document doc, WSSecHeader secHeader) throws WSSecurityException, org.apache.ws.security.conversation.ConversationException
      Throws:
      WSSecurityException
      org.apache.ws.security.conversation.ConversationException
    • getInclusivePrefixes

      protected Set getInclusivePrefixes(Element target)
    • getInclusivePrefixes

      protected Set getInclusivePrefixes(Element target, boolean excludeVisible)
    • addReferencesToSign

      public void addReferencesToSign(Vector references, WSSecHeader secHeader) throws WSSecurityException
      This method adds references to the Signature. The added references are signed when calling computeSignature(). This method can be called several times to add references as required. addReferencesToSign() can be called anytime after prepare.
      Parameters:
      references - A vector containing WSEncryptionPart objects that define the parts to sign.
      secHeader - Used to compute namespaces to be inserted by InclusiveNamespaces to be WSI compliant.
      Throws:
      WSSecurityException
    • createSTRParameter

      protected Element createSTRParameter(Document doc)
    • prependSigToHeader

      public void prependSigToHeader(WSSecHeader secHeader)
      Prepends the Signature element to the elements already in the Security header. The method can be called any time after prepare(). This allows to insert the Signature element at any position in the Security header.
      Parameters:
      securityHeader - The secHeader that holds the Signature element.
    • appendSigToHeader

      public void appendSigToHeader(WSSecHeader secHeader)
    • getSignatureElement

      public Element getSignatureElement()
      Returns the signature Element. The method can be called any time after prepare().
      Returns:
    • computeSignature

      public void computeSignature() throws WSSecurityException
      Compute the Signature over the references. After references are set this method computes the Signature for them. This method can be called anytime after the references were set. See addReferencesToSign().
      Throws:
      WSSecurityException
    • getDerivedKeyLength

      protected int getDerivedKeyLength() throws WSSecurityException
      Description copied from class: WSSecDerivedKeyBase
      The derived key will change depending on the sig/encr algorithm. Therefore the child classes are expected to provide this value.
      Specified by:
      getDerivedKeyLength in class WSSecDerivedKeyBase
      Returns:
      Throws:
      WSSecurityException
      See Also:
    • setSignatureAlgorithm

      public void setSignatureAlgorithm(String algo)
    • getSignatureValue

      public byte[] getSignatureValue()
      Returns:
      Returns the signatureValue.
    • setSigCanonicalization

      public void setSigCanonicalization(String algo)
      Set the canonicalization method to use. If the canonicalization method is not set then the recommended Exclusive XML Canonicalization is used by default Refer to WSConstants which algorithms are supported.
      Parameters:
      algo - Is the name of the signature algorithm
      See Also:
    • getSigCanonicalization

      public String getSigCanonicalization()
      Get the canonicalization method. If the canonicalization method was not set then Exclusive XML Canonicalization is used by default.
      Returns:
      The string describing the canonicalization algorithm.