org.apache.ws.security.message
Class WSSecDKEncrypt

java.lang.Object
  extended by org.apache.ws.security.message.WSSecBase
      extended by org.apache.ws.security.message.WSSecSignatureBase
          extended by org.apache.ws.security.message.WSSecDerivedKeyBase
              extended by org.apache.ws.security.message.WSSecDKEncrypt

public class WSSecDKEncrypt
extends WSSecDerivedKeyBase

Encrypts and signs 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
protected  String symEncAlgo
           
 
Fields inherited from class org.apache.ws.security.message.WSSecDerivedKeyBase
clientLabel, derivedKeyBytes, derivedKeyLength, dkt, dktId, document, envelope, ephemeralKey, serviceLabel, strElem, tokenIdDirectId, tokenIdentifier
 
Fields inherited from class org.apache.ws.security.message.WSSecBase
callbackLookup, doDebug, keyIdentifierType, parts, password, user
 
Constructor Summary
WSSecDKEncrypt()
           
WSSecDKEncrypt(WSSConfig config)
           
 
Method Summary
 void addExternalRefElement(Element referenceList, WSSecHeader secHeader)
          Adds (prepends) the external Reference element to the Security header.
 Document build(Document doc, WSSecHeader secHeader)
           
 Element encryptForExternalRef(Element dataRef, List<WSEncryptionPart> 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(String algo)
          Set the symmetric encryption algorithm URI to use
 
Methods inherited from class org.apache.ws.security.message.WSSecDerivedKeyBase
appendDKElementToHeader, getdktElement, getId, getTokenIdentifier, prepare, prependDKElementToHeader, setClientLabel, setCustomValueType, setDerivedKeyLength, setExternalKey, setExternalKey, setServiceLabel, setTokenIdDirectId, setWscVersion
 
Methods inherited from class org.apache.ws.security.message.WSSecSignatureBase
addReferencesToSign, createSTRParameter, getInclusivePrefixes, getInclusivePrefixes
 
Methods inherited from class org.apache.ws.security.message.WSSecBase
getKeyIdentifierType, getWsConfig, setBodyID, setCallbackLookup, setKeyIdentifierType, setParts, setUserInfo, setWsConfig, setWsuId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symEncAlgo

protected String symEncAlgo
Constructor Detail

WSSecDKEncrypt

public WSSecDKEncrypt()

WSSecDKEncrypt

public WSSecDKEncrypt(WSSConfig config)
Method Detail

build

public Document build(Document doc,
                      WSSecHeader secHeader)
               throws WSSecurityException,
                      ConversationException
Throws:
WSSecurityException
ConversationException

encryptForExternalRef

public Element encryptForExternalRef(Element dataRef,
                                     List<WSEncryptionPart> references)
                              throws WSSecurityException
Encrypt one or more parts or elements of the message (external). This method takes a vector of WSEncryptionPart 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 the xenc:Reference element. This method can be called after prepare() and can be called multiple times to encrypt a number of parts or elements. The method generates a xenc:Reference element that must be added to the SecurityHeader. See addExternalRefElement(). If the dataRef parameter is null the method creates and initializes a new Reference element.

Parameters:
dataRef - A xenc:Reference element or null
references - A list containing WSEncryptionPart objects
Returns:
Returns the updated xenc:Reference element
Throws:
WSSecurityException

addExternalRefElement

public void addExternalRefElement(Element referenceList,
                                  WSSecHeader secHeader)
Adds (prepends) the external Reference element to the Security header. The reference element must be created by the encryptForExternalRef() method. The method adds the reference element in the SecurityHeader.

Parameters:
referenceList - The external enc:Reference element
secHeader - The security header.

setSymmetricEncAlgorithm

public void setSymmetricEncAlgorithm(String algo)
Set the symmetric encryption algorithm URI to use

Parameters:
algo - the symmetric encryption algorithm URI to use

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:
the derived key length
Throws:
WSSecurityException
See Also:
WSSecDerivedKeyBase.getDerivedKeyLength()


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.