Package org.apache.ws.security.message
Class WSSecDKEncrypt
- java.lang.Object
-
- org.apache.ws.security.message.WSSecBase
-
- org.apache.ws.security.message.WSSecDerivedKeyBase
-
- org.apache.ws.security.message.WSSecDKEncrypt
-
public class WSSecDKEncrypt extends WSSecDerivedKeyBase
Encrypts and signes parts of a message with derived keys derived from a symmetric key. This symmetric key will be included as an EncryptedKey- Author:
- Ruchith Fernando (ruchith.fernando@gmail.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
symEncAlgo
-
Fields inherited from class org.apache.ws.security.message.WSSecDerivedKeyBase
clientLabel, derivedKeyBytes, derivedKeyLength, dkt, dktId, document, envelope, ephemeralKey, serviceLabel, strElem, tokenIdentifier
-
-
Constructor Summary
Constructors Constructor Description WSSecDKEncrypt()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExternalRefElement(org.w3c.dom.Element referenceList, WSSecHeader secHeader)
Adds (prepends) the external Reference element to the Security header.org.w3c.dom.Document
build(org.w3c.dom.Document doc, WSSecHeader secHeader)
static org.w3c.dom.Element
createDataRefList(org.w3c.dom.Document doc, org.w3c.dom.Element referenceList, java.util.Vector encDataRefs)
org.w3c.dom.Element
encryptForExternalRef(org.w3c.dom.Element dataRef, java.util.Vector references)
Encrypt one or more parts or elements of the message (external).protected int
getDerivedKeyLength()
The derived key will change depending on the sig/encr algorithm.void
setSymmetricEncAlgorithm(java.lang.String algo)
-
Methods inherited from class org.apache.ws.security.message.WSSecDerivedKeyBase
appendDKElementToHeader, getdktElement, getId, getTokenIdentifier, prepare, prependDKElementToHeader, setClientLabel, setDerivedKeyLength, setExternalKey, setExternalKey, setServiceLabel, setWscVersion
-
Methods inherited from class org.apache.ws.security.message.WSSecBase
getKeyIdentifierType, setBodyID, setKeyIdentifierType, setParts, setUserInfo, setWsConfig, setWsuId
-
-
-
-
Method Detail
-
build
public org.w3c.dom.Document build(org.w3c.dom.Document doc, WSSecHeader secHeader) throws WSSecurityException, org.apache.ws.security.conversation.ConversationException
- Throws:
WSSecurityException
org.apache.ws.security.conversation.ConversationException
-
encryptForExternalRef
public org.w3c.dom.Element encryptForExternalRef(org.w3c.dom.Element dataRef, java.util.Vector references) throws WSSecurityException
Encrypt one or more parts or elements of the message (external). This method takes a vector ofWSEncryptionPart
object that contain information about the elements to encrypt. The method call the encryption method, takes the reference information generated during encryption and add this to thexenc:Reference
element. This method can be called afterprepare()
and can be called multiple times to encrypt a number of parts or elements. The method generates axenc:Reference
element that must be added to the SecurityHeader. SeeaddExternalRefElement()
. If thedataRef
parameter isnull
the method creates and initializes a new Reference element.- Parameters:
dataRef
- Axenc:Reference
element ornull
references
- A vector containing WSEncryptionPart objects- Returns:
- Returns the updated
xenc:Reference
element - Throws:
WSSecurityException
-
addExternalRefElement
public void addExternalRefElement(org.w3c.dom.Element referenceList, WSSecHeader secHeader)
Adds (prepends) the external Reference element to the Security header. The reference element must be created by theencryptForExternalRef()
method. The method adds the reference element in the SecurityHeader.- Parameters:
dataRef
- The externalenc:Reference
elementsecHeader
- The security header.
-
createDataRefList
public static org.w3c.dom.Element createDataRefList(org.w3c.dom.Document doc, org.w3c.dom.Element referenceList, java.util.Vector encDataRefs)
-
setSymmetricEncAlgorithm
public void setSymmetricEncAlgorithm(java.lang.String algo)
-
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 classWSSecDerivedKeyBase
- Returns:
- Throws:
WSSecurityException
- See Also:
WSSecDerivedKeyBase.getDerivedKeyLength()
-
-