Package org.apache.wss4j.dom.message
Class WSSecDerivedKeyBase
java.lang.Object
org.apache.wss4j.dom.message.WSSecBase
org.apache.wss4j.dom.message.WSSecSignatureBase
org.apache.wss4j.dom.message.WSSecDerivedKeyBase
- Direct Known Subclasses:
WSSecDKEncrypt,WSSecDKSign
Base class for DerivedKey encryption and signature
-
Field Summary
Fields inherited from class org.apache.wss4j.dom.message.WSSecBase
addWSUNamespace, attachmentCallbackHandler, callbackLookup, expandXopInclude, keyIdentifierType, password, storeBytesInAttachment, user -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclean()protected SecretKeygetDerivedKey(String algorithm) protected abstract intThe derived key will change depending on the sig/encr algorithm.getId()Get the id generated duringprepare().intvoidprepare(byte[] ephemeralKey) Initialize a WSSec Derived key.voidPrepend the DerivedKey element to the elements already in the Security header.voidsetClientLabel(String clientLabel) Set the label value of the client.voidvoidsetCustomValueType(String customValueType) voidsetServiceLabel(String serviceLabel) Set the label value of the service.voidsetStrElem(Element strElem) voidsetTokenIdDirectId(boolean b) voidsetTokenIdentifier(String tokenIdentifier) voidsetWscVersion(int wscVersion) voidSet the X509 Certificate to useMethods inherited from class org.apache.wss4j.dom.message.WSSecSignatureBase
addReferencesToSign, cleanup, createSTRParameter, getInclusivePrefixes, getInclusivePrefixesMethods inherited from class org.apache.wss4j.dom.message.WSSecBase
getDocument, getIdAllocator, getKeyIdentifierType, getParts, getSecurityHeader, getWsDocInfo, isExpandXopInclude, setAttachmentCallbackHandler, setBodyID, setCallbackLookup, setExpandXopInclude, setIdAllocator, setKeyIdentifierType, setStoreBytesInAttachment, setUserInfo, setWsDocInfo, setWsuId
-
Constructor Details
-
WSSecDerivedKeyBase
-
WSSecDerivedKeyBase
-
-
Method Details
-
getDerivedKeyLength
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
-
setStrElem
-
setTokenIdentifier
-
getTokenIdentifier
- Returns:
- Returns the tokenIdentifier.
-
setX509Certificate
Set the X509 Certificate to use- Parameters:
cer- the X509 Certificate to use
-
getId
Get the id generated duringprepare(). 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
Set the label value of the client.- Parameters:
clientLabel-
-
setServiceLabel
Set the label value of the service.- Parameters:
serviceLabel-
-
prepare
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 afterprepare(). 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
-
setCustomValueType
-
setTokenIdDirectId
public void setTokenIdDirectId(boolean b) -
setCrypto
-
getDerivedKey
-
clean
public void clean()
-