Class WSSecDerivedKeyBase

Direct Known Subclasses:
WSSecDKEncrypt, WSSecDKSign

public abstract class WSSecDerivedKeyBase extends WSSecSignatureBase
Base class for DerivedKey encryption and signature
  • Constructor Details

    • WSSecDerivedKeyBase

      public WSSecDerivedKeyBase(WSSecHeader securityHeader)
    • WSSecDerivedKeyBase

      public WSSecDerivedKeyBase(Document doc)
  • Method Details

    • getDerivedKeyLength

      protected abstract int getDerivedKeyLength() throws WSSecurityException
      The derived key will change depending on the sig/encr algorithm. Therefore the child classes are expected to provide this value.
      Returns:
      the derived key length
      Throws:
      WSSecurityException
    • getStrElem

      public Element getStrElem()
    • setStrElem

      public void setStrElem(Element strElem)
    • setTokenIdentifier

      public void setTokenIdentifier(String tokenIdentifier)
    • getTokenIdentifier

      public String getTokenIdentifier()
      Returns:
      Returns the tokenIdentifier.
    • setX509Certificate

      public void setX509Certificate(X509Certificate cer)
      Set the X509 Certificate to use
      Parameters:
      cer - the X509 Certificate to use
    • getId

      public String getId()
      Get the id generated during prepare(). Returns the the value of wsu:Id attribute of the DerivedKeyToken element.
      Returns:
      Return the wsu:Id of this token or null if prepare() was not called before.
    • setClientLabel

      public void setClientLabel(String clientLabel)
      Set the label value of the client.
      Parameters:
      clientLabel -
    • setServiceLabel

      public void setServiceLabel(String serviceLabel)
      Set the label value of the service.
      Parameters:
      serviceLabel -
    • prepare

      public void prepare(byte[] ephemeralKey) throws WSSecurityException
      Initialize a WSSec Derived key. The method prepares and initializes a WSSec derived key structure after the relevant information was set. This method also creates and initializes the derived token using the ephemeral key. After preparation references can be added, encrypted and signed as required. This method does not add any element to the security header. This must be done explicitly.
      Parameters:
      ephemeralKey - The ephemeral key to use for derivation
      Throws:
      WSSecurityException
    • prependDKElementToHeader

      public void prependDKElementToHeader()
      Prepend the DerivedKey element to the elements already in the Security header. The method can be called any time after prepare(). This allows to insert the DerivedKey element at any position in the Security header.
    • appendDKElementToHeader

      public void appendDKElementToHeader()
    • setWscVersion

      public void setWscVersion(int wscVersion)
      Parameters:
      wscVersion - The wscVersion to set.
    • getWscVersion

      public int getWscVersion()
    • getdktElement

      public Element getdktElement()
    • setCustomValueType

      public void setCustomValueType(String customValueType)
    • setTokenIdDirectId

      public void setTokenIdDirectId(boolean b)
    • setCrypto

      public void setCrypto(Crypto crypto)
    • getDerivedKey

      protected SecretKey getDerivedKey(String algorithm)
    • clean

      public void clean()
      Overrides:
      clean in class WSSecBase