org.apache.xml.security.encryption
Class EncryptedData

java.lang.Object
  |
  +--org.apache.xml.security.utils.ElementProxy
        |
        +--org.apache.xml.security.utils.EncryptionElementProxy
              |
              +--org.apache.xml.security.encryption.EncryptedData
All Implemented Interfaces:
EncryptedType

public class EncryptedData
extends EncryptionElementProxy
implements EncryptedType

This class maps to the xenc:EncryptedData element.

Author:
$Author: vdkoogh $

Field Summary
 
Fields inherited from class org.apache.xml.security.utils.ElementProxy
_baseURI, _constructionElement, _doc, _state, MODE_CREATE, MODE_DECRYPT, MODE_ENCRYPT, MODE_PROCESS, MODE_SIGN, MODE_UNKNOWN, MODE_VERIFY
 
Constructor Summary
EncryptedData(org.w3c.dom.Document doc, EncryptionMethod encryptionMethod, KeyInfo keyInfo, CipherData cipherData, EncryptionProperties encryptionProperties, java.lang.String Id, java.lang.String Type)
          Constructor EncryptedData
EncryptedData(org.w3c.dom.Document doc, java.lang.String encryptionMethod, EncryptionMethodParams encryptionMethodParams, KeyInfo keyInfo, CipherData cipherData, EncryptionProperties encryptionProperties, java.lang.String Id, java.lang.String Type)
          Constructor EncryptedData
EncryptedData(org.w3c.dom.Document doc, java.lang.String encryptionMethod, EncryptionMethodParams encryptionMethodParams, KeyInfo keyInfo, EncryptionProperties encryptionProperties, java.lang.String Id)
          Constructor EncryptedData
EncryptedData(org.w3c.dom.Element element, java.lang.String BaseURI)
          Constructor EncryptedData
 
Method Summary
 java.security.Key createSecretKeyFromBytes(byte[] encodedKey)
          Method createSecretKeyFromBytes
 void decryptAndReplace(java.security.Key contentDecryptionKey)
          Method decryptAndReplace
 void encryptContentAndReplace(org.w3c.dom.Node firstPlaintextNode, int length, java.security.Key contentEncryptionKey)
          Encrypts some child Nodes of a given Element.
 void encryptContentAndReplace(org.w3c.dom.Node parentOfPlaintext, java.security.Key contentEncryptionKey)
          Encrypts all child Nodes of a given Element.
 void encryptElementAndReplace(org.w3c.dom.Element plaintextElement, java.security.Key secretKey)
          Method encryptAndReplace
 java.lang.String getBaseLocalName()
          Returns the localname of the Elements of the sub-class.
 CipherData getCipherData()
          Method getCipherData
 EncryptionMethod getEncryptionMethod()
          Method getEncryptionMethod
 EncryptionProperties getEncryptionProperties()
          Method getEncryptionProperties
 java.lang.String getId()
          Returns the Id attribute
 KeyInfo getKeyInfo()
          Method getKeyInfo
 java.lang.String getMediaTypeOfType()
          Method getMediaTypeOfType
 java.lang.String getType()
          Method getType
 boolean getTypeIsContent()
          Method getTypeIsContent
 boolean getTypeIsElement()
          Method getTypeIsElement
 boolean getTypeIsMediaType()
          Method getTypeIsMediaType
static void main(java.lang.String[] unused)
          Method main
static int min(int a, int b)
          Method min
static int min(int a, int b, int c)
          Method min
static org.w3c.dom.Element replace(org.w3c.dom.Element oldElement, byte[] plaintextBytes)
          Method replace
static org.w3c.dom.Element replace(org.w3c.dom.Element oldElement, org.w3c.dom.Element newElement)
          Replaces an old Element by a new one
static org.w3c.dom.Element replace(org.w3c.dom.Element oldElement, org.w3c.dom.NodeList newContent)
          Method replace
 void setId(java.lang.String Id)
          Sets the Id attribute
 void setType(java.lang.String Type)
          Method setType
 
Methods inherited from class org.apache.xml.security.utils.EncryptionElementProxy
getBaseNamespace
 
Methods inherited from class org.apache.xml.security.utils.ElementProxy
addBase64Element, addBase64Text, addBigIntegerElement, addText, addTextElement, createElementForFamily, getBaseURI, getBigIntegerFromChildElement, getBytesFromChildElement, getBytesFromTextChild, getChildElementLocalName, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getTextFromChildElement, getTextFromTextChild, guaranteeThatElementInCorrectSpace, length, setDefaultPrefix, setElement, setXPathNamespaceContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptedData

public EncryptedData(org.w3c.dom.Document doc,
                     EncryptionMethod encryptionMethod,
                     KeyInfo keyInfo,
                     CipherData cipherData,
                     EncryptionProperties encryptionProperties,
                     java.lang.String Id,
                     java.lang.String Type)
              throws XMLSecurityException
Constructor EncryptedData

Parameters:
doc -
encryptionMethod -
keyInfo -
cipherData -
encryptionProperties -
Id -
Type -
Throws:
XMLSecurityException

EncryptedData

public EncryptedData(org.w3c.dom.Document doc,
                     java.lang.String encryptionMethod,
                     EncryptionMethodParams encryptionMethodParams,
                     KeyInfo keyInfo,
                     EncryptionProperties encryptionProperties,
                     java.lang.String Id)
              throws XMLSecurityException
Constructor EncryptedData

Parameters:
doc -
encryptionMethod -
encryptionMethodParams -
keyInfo -
encryptionProperties -
Id -
Throws:
XMLSecurityException

EncryptedData

public EncryptedData(org.w3c.dom.Document doc,
                     java.lang.String encryptionMethod,
                     EncryptionMethodParams encryptionMethodParams,
                     KeyInfo keyInfo,
                     CipherData cipherData,
                     EncryptionProperties encryptionProperties,
                     java.lang.String Id,
                     java.lang.String Type)
              throws XMLSecurityException
Constructor EncryptedData

Parameters:
doc -
encryptionMethod -
encryptionMethodParams -
keyInfo -
cipherData -
encryptionProperties -
Id -
Type -
Throws:
XMLSecurityException

EncryptedData

public EncryptedData(org.w3c.dom.Element element,
                     java.lang.String BaseURI)
              throws XMLSecurityException
Constructor EncryptedData

Parameters:
element -
BaseURI -
Throws:
XMLSecurityException
Method Detail

getEncryptionMethod

public EncryptionMethod getEncryptionMethod()
                                     throws XMLSecurityException
Method getEncryptionMethod

Specified by:
getEncryptionMethod in interface EncryptedType
Throws:
XMLSecurityException

getKeyInfo

public KeyInfo getKeyInfo()
                   throws XMLSecurityException
Method getKeyInfo

Specified by:
getKeyInfo in interface EncryptedType
Throws:
XMLSecurityException

getCipherData

public CipherData getCipherData()
                         throws XMLSecurityException
Method getCipherData

Specified by:
getCipherData in interface EncryptedType
Throws:
XMLSecurityException

getEncryptionProperties

public EncryptionProperties getEncryptionProperties()
                                             throws XMLSecurityException
Method getEncryptionProperties

Specified by:
getEncryptionProperties in interface EncryptedType
Throws:
XMLSecurityException

setId

public void setId(java.lang.String Id)
Sets the Id attribute

Parameters:
Id - ID

getId

public java.lang.String getId()
Returns the Id attribute

Specified by:
getId in interface EncryptedType
Returns:
the Id attribute

setType

public void setType(java.lang.String Type)
Method setType

Parameters:
Type -

getType

public java.lang.String getType()
Method getType

Specified by:
getType in interface EncryptedType

getTypeIsElement

public boolean getTypeIsElement()
Method getTypeIsElement

Specified by:
getTypeIsElement in interface EncryptedType

getTypeIsContent

public boolean getTypeIsContent()
Method getTypeIsContent

Specified by:
getTypeIsContent in interface EncryptedType

getTypeIsMediaType

public boolean getTypeIsMediaType()
Method getTypeIsMediaType

Specified by:
getTypeIsMediaType in interface EncryptedType

getMediaTypeOfType

public java.lang.String getMediaTypeOfType()
Method getMediaTypeOfType

Specified by:
getMediaTypeOfType in interface EncryptedType

replace

public static org.w3c.dom.Element replace(org.w3c.dom.Element oldElement,
                                          org.w3c.dom.NodeList newContent)
Method replace

Parameters:
oldElement -
newContent -

replace

public static org.w3c.dom.Element replace(org.w3c.dom.Element oldElement,
                                          org.w3c.dom.Element newElement)
Replaces an old Element by a new one

Parameters:
oldElement - the old Element which has to be removed from the Document
newElement - the new Element which has to be place in the position of oldElement
Returns:
the removed element

replace

public static org.w3c.dom.Element replace(org.w3c.dom.Element oldElement,
                                          byte[] plaintextBytes)
                                   throws XMLSecurityException
Method replace

Parameters:
oldElement -
plaintextBytes -
Throws:
XMLSecurityException

createSecretKeyFromBytes

public java.security.Key createSecretKeyFromBytes(byte[] encodedKey)
                                           throws XMLSecurityException
Method createSecretKeyFromBytes

Parameters:
encodedKey -
Throws:
XMLSecurityException

encryptElementAndReplace

public void encryptElementAndReplace(org.w3c.dom.Element plaintextElement,
                                     java.security.Key secretKey)
                              throws XMLSecurityException
Method encryptAndReplace

Parameters:
plaintextElement -
secretKey -
Throws:
XMLSecurityException

encryptContentAndReplace

public void encryptContentAndReplace(org.w3c.dom.Node parentOfPlaintext,
                                     java.security.Key contentEncryptionKey)
                              throws XMLSecurityException
Encrypts all child Nodes of a given Element.

Parameters:
parentOfPlaintext - the parent of the Nodes which are to be encrypted. All child nodes will be encrypted but not the parent itself.
contentEncryptionKey - the Key which is used to encrypt the data
Throws:
XMLSecurityException

encryptContentAndReplace

public void encryptContentAndReplace(org.w3c.dom.Node firstPlaintextNode,
                                     int length,
                                     java.security.Key contentEncryptionKey)
                              throws XMLSecurityException
Encrypts some child Nodes of a given Element.

Parameters:
firstPlaintextNode - the first Node to be encrypted
length - the total number of Nodes to be encrypted (the firstPlaintextNode and (length-1) next siblings)
contentEncryptionKey - the Key which is used to encrypt the data
Throws:
XMLSecurityException

decryptAndReplace

public void decryptAndReplace(java.security.Key contentDecryptionKey)
                       throws XMLSecurityException
Method decryptAndReplace

Parameters:
contentDecryptionKey -
Throws:
XMLSecurityException

main

public static void main(java.lang.String[] unused)
                 throws java.lang.Exception
Method main

Parameters:
unused -
Throws:
java.lang.Exception

min

public static int min(int a,
                      int b,
                      int c)
Method min

Parameters:
a -
b -
c -

min

public static int min(int a,
                      int b)
Method min

Parameters:
a -
b -

getBaseLocalName

public java.lang.String getBaseLocalName()
Description copied from class: ElementProxy
Returns the localname of the Elements of the sub-class.

Specified by:
getBaseLocalName in class ElementProxy
Returns:
the localname of the Elements of the sub-class.