Oracle Security Developer Tools XML Security Java API Reference
10g (10.1.4.0.1)

B28178-01


oracle.security.xmlsec.enc
Class XEEncryptedData

java.lang.Object
  extended byoracle.security.xmlsec.util.XMLNode
      extended byoracle.security.xmlsec.util.XMLElement
          extended byoracle.security.xmlsec.enc.XEEncryptedObject
              extended byoracle.security.xmlsec.enc.XEEncryptedData


public class XEEncryptedData
extends XEEncryptedObject

The XML-ENC EncryptedData element.

Block encryption algorithms triple DES, AES-128, AES-192 and AES-256 are supported.

An optional Type URI may be used to indicate the type of the encrypted object, which should be used where possible to aid in decryption processing. Standard encrypted object type URI constants can be found in XMLURI, including:

See Also:
XEEncryptedObject, XEEncryptedKey

Field Summary

 

Fields inherited from class oracle.security.xmlsec.util.XMLNode
node, systemId

 

Constructor Summary
XEEncryptedData(org.w3c.dom.Element encData)
          Create a XEEncryptedData instance from the given EncryptedData element.
XEEncryptedData(org.w3c.dom.Element encData, java.lang.String systemId)
          Create a XEEncryptedData instance from the given EncryptedData element.

 

Method Summary
 byte[] decrypt()
          Decrypts the cipher value and returns the decrypted value in bytes.
 byte[] decrypt(oracle.security.crypto.core.SymmetricKey key)
          Decrypts the cipher value with the given key and returns the decrypted value in bytes.
 org.w3c.dom.NodeList decryptAndParse()
          Decrypts the cipher value and returns the decrypted value as XML.
 org.w3c.dom.NodeList decryptAndParse(boolean parentInNodeSet)
          Decrypts the cipher value and returns the decrypted value as XML.
 org.w3c.dom.NodeList decryptAndParse(oracle.security.crypto.core.SymmetricKey key)
          Decrypts the cipher value with the given key, and returns the decrypted value as XML.
 org.w3c.dom.NodeList decryptAndParse(oracle.security.crypto.core.SymmetricKey key, boolean parentInNodeSet)
          Decrypt the cipher value with the given key, and returns the decrypted cipher value as XML.
static org.w3c.dom.Element decryptAndReplace(org.w3c.dom.Element encDataElement)
          This static method is used to decrypt the given EncryptedData element with the given key, and replaces the EncrypteData element with the decrypted XML result.
static org.w3c.dom.Element decryptAndReplace(org.w3c.dom.Element encDataElement, boolean parentInNodeSet)
          This static method is used to decrypt the given EncryptedData element with the given key, and replaces the EncrypteData element with the decrypted XML result.
static org.w3c.dom.Element decryptAndReplace(oracle.security.crypto.core.SymmetricKey key, org.w3c.dom.Element encDataElement)
          This static method is used to decrypt the given EncryptedData element with the given key, and replaces the EncrypteData element with the decrypted XML result.
static org.w3c.dom.Element decryptAndReplace(oracle.security.crypto.core.SymmetricKey key, org.w3c.dom.Element encDataElement, boolean parentInNodeSet)
          This static method is used to decrypt the given EncryptedData element with the given key, and replaces the EncrypteData element with the decrypted XML result.
 byte[] encrypt(byte[] bytes)
          Encrypts an array of bytes using block cipher with the given symmetric key.
 byte[] encrypt(byte[] bytes, byte[] iv)
          Encrypts an array of bytes using block cipher with the and the initialization vector.
 byte[] encrypt(byte[] bytes, oracle.security.crypto.core.SymmetricKey key)
          Encrypts an array of bytes using block cipher.
 byte[] encrypt(byte[] bytes, oracle.security.crypto.core.SymmetricKey key, byte[] iv)
          Encrypts an array of bytes using block cipher with the given symmetric key and initialization vector.
 byte[] encrypt(org.w3c.dom.Element element)
          Encrypts an XML Element or XML Element Content using block cipher.
 byte[] encrypt(org.w3c.dom.Element element, byte[] iv)
          Encrypts an XML Element or XML Element Content using block cipher with the initialization vector.
 byte[] encrypt(org.w3c.dom.Element element, oracle.security.crypto.core.SymmetricKey key)
          Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key.
 byte[] encrypt(org.w3c.dom.Element element, oracle.security.crypto.core.SymmetricKey key, byte[] iv)
          Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key and the initialization vector.
static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element, byte[] iv, XEEncryptedData encData)
          Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key and the initialization vector.
static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element, oracle.security.crypto.core.SymmetricKey key, byte[] iv, XEEncryptedData encData)
          Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key and the initialization vector.
static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element, oracle.security.crypto.core.SymmetricKey key, XEEncryptedData encData)
          Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key.
static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element, XEEncryptedData encData)
          Encrypts an XML Element or XML Element Content using block cipher.
 byte[] getNonce()
          Get the nonce value specified by using the method setNonce.
 int getNonceLength()
          Get the Nonce attribute value of this EncryptedData element, which indicates the presence and length of a nonce value prepended to the plain text.
static XEEncryptedData newInstance(org.w3c.dom.Document doc, java.lang.String id)
          Creates a new XEEncryptedData instance in the given owner document, but does not append it to any element.
static XEEncryptedData newInstance(org.w3c.dom.Document doc, java.lang.String id, java.lang.String dataType)
          Creates a new XEEncryptedData instance in the given owner document, but does not append it to any element.
static XEEncryptedData newInstance(java.lang.String id)
          Creates a new XEEncryptedData instance in a new owner document, and makes it the root element of the document.
static XEEncryptedData newInstance(java.lang.String id, java.lang.String dataType)
          Creates a new XEEncryptedData instance in a new owner document, and makes it the root element of the document.
 void replaceElement(org.w3c.dom.Element element, boolean contentOnly)
          Replace an XML Element or its content in its owner XML Document with the EncryptedData element in this structure.
 void setNonce(byte[] nonce)
          Set the nonce value to be prepended to the plain text.

 

Methods inherited from class oracle.security.xmlsec.enc.XEEncryptedObject
createCipherData, createCipherData, createCipherReference, createDataReference, createEncryptionMethod, createEncryptionProperties, createEncryptionProperties, createEncryptionProperty, createEncryptionProperty, createKeyInfo, createKeyInfo, createKeyReference, createOriginatorKeyInfo, createRecipientKeyInfo, getCipherData, getDataType, getDecryptionKey, getEncoding, getEncryptionKey, getEncryptionMethod, getEncryptionProperties, getId, getInstance, getInstance, getKeyInfo, getMimeType, setCipherData, setDataType, setEncoding, setEncryptionMethod, setEncryptionProperties, setId,

 

Methods inherited from class oracle.security.xmlsec.util.XMLElement
addNSPrefixAttr, addNSPrefixAttr, addNSPrefixAttrDefault, addNSPrefixAttrDefault, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getChildElementsByTagName, getChildElementsByTagName, getChildElementsByTagNameNS, getChildElementsByTagNameNS, getDefaultNSPrefix, getElementsByTagName, getElementsByTagNameNS, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setDefaultNSPrefix

 

Methods inherited from class oracle.security.xmlsec.util.XMLNode
appendChild, appendChild, appendTo, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNode, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getSystemId, hasAttributes, hasChildNodes, insertBefore, insertBefore, isSupported, normalize, removeChild, removeChild, replaceChild, replaceChild, setNodeValue, setPrefix, setSystemId, toBytesXML, toStringXML

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

XEEncryptedData

public XEEncryptedData(org.w3c.dom.Element encData)
                throws org.w3c.dom.DOMException
Create a XEEncryptedData instance from the given EncryptedData element.
Parameters:
encData - An EncryptedData element.

XEEncryptedData

public XEEncryptedData(org.w3c.dom.Element encData,
                       java.lang.String systemId)
                throws org.w3c.dom.DOMException
Create a XEEncryptedData instance from the given EncryptedData element.
Parameters:
encData - An EncryptedData element.
systemId - The URI string system ID for the XEEncryptedData.
Since:
2.0

Method Detail

newInstance

public static XEEncryptedData newInstance(java.lang.String id)
                                   throws org.w3c.dom.DOMException
Creates a new XEEncryptedData instance in a new owner document, and makes it the root element of the document.
Parameters:
id - The optional ID name for this EncryptedData element.
Throws:
org.w3c.dom.DOMException

newInstance

public static XEEncryptedData newInstance(java.lang.String id,
                                          java.lang.String dataType)
                                   throws org.w3c.dom.DOMException
Creates a new XEEncryptedData instance in a new owner document, and makes it the root element of the document.
Parameters:
id - The optional ID name for this EncryptedData element.
dataType - An optional URI identifying the type of the data to be encrypted.
Throws:
org.w3c.dom.DOMException

newInstance

public static XEEncryptedData newInstance(org.w3c.dom.Document doc,
                                          java.lang.String id)
                                   throws org.w3c.dom.DOMException
Creates a new XEEncryptedData instance in the given owner document, but does not append it to any element.
Parameters:
doc - An XML Document to be used as the owner document of this EncryptedData element.
id - The optional ID name for this EncryptedData element.
Throws:
org.w3c.dom.DOMException

newInstance

public static XEEncryptedData newInstance(org.w3c.dom.Document doc,
                                          java.lang.String id,
                                          java.lang.String dataType)
                                   throws org.w3c.dom.DOMException
Creates a new XEEncryptedData instance in the given owner document, but does not append it to any element.
Parameters:
doc - An XML Document to be used as the owner document of this EncryptedData element.
id - The optional ID name for this EncryptedData element.
dataType - An optional URI identifying the type of the data to be encrypted.
Throws:
org.w3c.dom.DOMException

setNonce

public void setNonce(byte[] nonce)
Set the nonce value to be prepended to the plain text.
Parameters:
nonce - The nonce value.

getNonce

public byte[] getNonce()
Get the nonce value specified by using the method setNonce.
Returns:
The nonce value, or null if not specified.

getNonceLength

public int getNonceLength()
Get the Nonce attribute value of this EncryptedData element, which indicates the presence and length of a nonce value prepended to the plain text.
Returns:
The length of the nonce value in bytes prepended to the plaintext, or 0 if a nonce is not used in the encryption.

replaceElement

public void replaceElement(org.w3c.dom.Element element,
                           boolean contentOnly)
                    throws org.w3c.dom.DOMException
Replace an XML Element or its content in its owner XML Document with the EncryptedData element in this structure.
Parameters:
element - The XML element to be replaced.
contentOnly - If true, only the content of the element will be replaced, otherwise the element itself.
Throws:
org.w3c.dom.DOMException

encrypt

public byte[] encrypt(byte[] bytes,
                      oracle.security.crypto.core.SymmetricKey key,
                      byte[] iv)
               throws XESchemaException,
                      XECipherException
Encrypts an array of bytes using block cipher with the given symmetric key and initialization vector. The cipher text is prefixed by the IV to obtain the cipherValue.
Parameters:
bytes - The bytes to be encrypted.
key - The key to be used in the encryption.
iv - The initialization vector.
Returns:
The bytes of the ciphertext.
Throws:
XESchemaException
XECipherException

encrypt

public byte[] encrypt(byte[] bytes,
                      byte[] iv)
               throws XEException
Encrypts an array of bytes using block cipher with the and the initialization vector. The cipher text is prefixed by the IV to obtain the cipherValue.

The KeyInfo is used to locate the encryption key using the KeyRetriever facility. If no KeyInfo is present, or if the encryption key cannot be retrieved, a XECipherException is thrown. This method should NOT be used if the encryption key is identified by an EncryptedKey element.

Parameters:
bytes - The plain bytes to be encrypted.
iv - The initialization vector.
Returns:
The bytes of the ciphertext.
Throws:
XEException

encrypt

public byte[] encrypt(byte[] bytes,
                      oracle.security.crypto.core.SymmetricKey key)
               throws XESchemaException,
                      XECipherException
Encrypts an array of bytes using block cipher. Use this method to encrypt data which is not of type XML Element or XML Element Content.
Parameters:
bytes - The bytes to be encrypted.
key - The key to be used in the encryption.
Returns:
The bytes of the ciphertext.
Throws:
XESchemaException
XECipherException

encrypt

public byte[] encrypt(byte[] bytes)
               throws XEException
Encrypts an array of bytes using block cipher with the given symmetric key.

The KeyInfo is used to locate the encryption key using the KeyRetriever facility. If no KeyInfo is present, or if the encryption key cannot be retrieved, a XECipherException is thrown. This method should NOT be used if the encryption key is identified by an EncryptedKey element.

Parameters:
bytes - The bytes to be encrypted.
Returns:
The bytes of the ciphertext.
Throws:
XEException

encrypt

public byte[] encrypt(org.w3c.dom.Element element,
                      oracle.security.crypto.core.SymmetricKey key,
                      byte[] iv)
               throws XESchemaException,
                      XECipherException
Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key and the initialization vector. The cipher text is prefixed by the IV to obtain the cipherValue. Use this method to encrypt data which is of type XML Element or XML Element Content, and when an initialization vector is supplied and the cipher value will be put in an external location to be refered via a CipherReference element in a CipherData element in this structure.

Note: The Type URI must be set before using this method.

Parameters:
element - The XML element to be encrypted.
key - The key to be used in the encryption.
iv - The initialization vector.
Returns:
The bytes of the ciphertext.
Throws:
XESchemaException
XECipherException

encrypt

public byte[] encrypt(org.w3c.dom.Element element,
                      byte[] iv)
               throws XEException
Encrypts an XML Element or XML Element Content using block cipher with the initialization vector. The cipher text is prefixed by the IV to obtain the cipherValue. Use this method to encrypt data which is of type XML Element or XML Element Content, and when an initialization vector is supplied and the cipher value will be put in an external location to be refered via a CipherReference element in a CipherData element in this structure.

Note: The Type URI must be set before using this method.

The KeyInfo is used to locate the encryption key using the KeyRetriever facility. If no KeyInfo is present, or if the encryption key cannot be retrieved, a XECipherException is thrown. This method should NOT be used if the encryption key is identified by an EncryptedKey element.

Parameters:
element - The XML element to be encrypted.
iv - The initialization vector.
Returns:
The bytes of the ciphertext.
Throws:
XEException

encrypt

public byte[] encrypt(org.w3c.dom.Element element,
                      oracle.security.crypto.core.SymmetricKey key)
               throws XESchemaException,
                      XECipherException
Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key. Use this method to encrypt data which is of type XML Element or XML Element Content and the cipher value will be put in an external location to be refered via a CipherReference element in an CipherData element in this structure.

Note: The Type URI must be set before using this method.

Parameters:
element - The XML element to be encrypted.
key - The key to be used in the encryption.
Returns:
The bytes of the ciphertext.
Throws:
XESchemaException
XECipherException

encrypt

public byte[] encrypt(org.w3c.dom.Element element)
               throws XEException
Encrypts an XML Element or XML Element Content using block cipher. Use this method to encrypt data which is of type XML Element or XML Element Content and the cipher value will be put in an external location to be refered via a CipherReference element in an CipherData element in this structure.

Note: The Type URI must be set before using this method.

The KeyInfo is used to locate the encryption key using the KeyRetriever facility. If no KeyInfo is present, or if the encryption key cannot be retrieved, a XECipherException is thrown. This method should NOT be used if the encryption key is identified by an EncryptedKey element.

Parameters:
element - The XML element to be encrypted.
Returns:
The bytes of the ciphertext.
Throws:
XEException

encryptAndReplace

public static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element,
                                                oracle.security.crypto.core.SymmetricKey key,
                                                byte[] iv,
                                                XEEncryptedData encData)
                                         throws XESchemaException,
                                                XECipherException
Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key and the initialization vector. The cipher text is prefixed by the IV to obtain the cipherValue. Use this method to encrypt data which is of type XML Element or XML Element Content, and when an initialization vector is supplied and the cipher value will be stored in a CipherValue element in a CipherData element in this structure.

Note: The Type URI must be set before using this method.

Parameters:
element - The XML element to be encrypted.
key - The key to be used in the encryption.
iv - The initialization vector.
Returns:
The new XEEncryptedData instance whose underlying EncryptedData element replaces the input plain element or its content in its parent node.
Throws:
XESchemaException
XECipherException

encryptAndReplace

public static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element,
                                                byte[] iv,
                                                XEEncryptedData encData)
                                         throws XEException
Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key and the initialization vector. The cipher text is prefixed by the IV to obtain the cipherValue. Use this method to encrypt data which is of type XML Element or XML Element Content, and when an initialization vector is supplied and the cipher value will be stored in a CipherValue element in a CipherData element in this structure.

Note: The Type URI must be set before using this method.

The KeyInfo is used to locate the encryption key using the KeyRetriever facility. If no KeyInfo is present, or if the encryption key cannot be retrieved, a XECipherException is thrown. This method should NOT be used if the encryption key is identified by an EncryptedKey element.

Parameters:
element - The XML element to be encrypted.
iv - The initialization vector.
Returns:
The new XEEncryptedData instance whose underlying EncryptedData element replaces the input plain element or its content in its parent node.
Throws:
XEException
Since:
1.2

encryptAndReplace

public static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element,
                                                oracle.security.crypto.core.SymmetricKey key,
                                                XEEncryptedData encData)
                                         throws XESchemaException,
                                                XECipherException
Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key. Use this method to encrypt data which is of type XML Element or XML Element Content, and when an initialization vector is supplied and the cipher value will be stored in a CipherValue element in a CipherData element in this structure.

Note: The Type URI must be set before using this method.

Parameters:
element - The XML element to be encrypted.
key - The key to be used in the encryption.
Returns:
The new XEEncryptedData instance whose underlying EncryptedData element replaces the input plain element or its content in its parent node.
Throws:
XESchemaException
XECipherException

encryptAndReplace

public static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element,
                                                XEEncryptedData encData)
                                         throws XEException
Encrypts an XML Element or XML Element Content using block cipher. Use this method to encrypt data which is of type XML Element or XML Element Content, and when an initialization vector is supplied and the cipher value will be stored in a CipherValue element in a CipherData element in this structure.

Note: The Type URI must be set before using this method.

The KeyInfo is used to locate the encryption key using the KeyRetriever facility. If no KeyInfo is present, or if the encryption key cannot be retrieved, a XECipherException is thrown. This method should NOT be used if the encryption key is identified by an EncryptedKey element.

Parameters:
element - The XML element to be encrypted.
Returns:
The new XEEncryptedData instance whose underlying EncryptedData element replaces the input plain element or its content in its parent node.
Throws:
XEException
Since:
1.2

decrypt

public byte[] decrypt(oracle.security.crypto.core.SymmetricKey key)
               throws XESchemaException,
                      XECipherException
Decrypts the cipher value with the given key and returns the decrypted value in bytes.

Use this method if the encrypted data type is not XML Element or element Content.

Returns:
The decrypted cipher value.
Throws:
XESchemaException
XECipherException

decrypt

public byte[] decrypt()
               throws XEException
Decrypts the cipher value and returns the decrypted value in bytes. The decryption key is obtained by resolving the KeyInfo element. The decryption key for the bottom of the EncryptedData EncryptedKey chain is obtained from the KeyRetriever facility.

Use this method if the encrypted data type is not XML Element or element Content.

Returns:
The decrypted cipher value.
Throws:
XEException
Since:
1.2

decryptAndParse

public org.w3c.dom.NodeList decryptAndParse(oracle.security.crypto.core.SymmetricKey key,
                                            boolean parentInNodeSet)
                                     throws XEException
Decrypt the cipher value with the given key, and returns the decrypted cipher value as XML.

Use this method if the encrypted data type is XML Element or element Content.

Parameters:
key - The key to be used in the decryption.
parentInNodeSet - true if the parent of the EncryptedData element is in the application's result node-set (e.g., if the entire document is to be processed), otherwise false. This information is used in augmenting the decrypted XML's apex nodes with inherited attributes from the XML namespace.
Returns:
A NodeList containing the apex nodes of the decrypted XML.
Throws:
XESchemaException - If the value of the EncryptedData's Type attribute is not "http://www.w3.org/2001/04/xmlenc#Element" or "http://www.w3.org/2001/04/xmlenc#Content".
XEException
Since:
2.0

decryptAndParse

public org.w3c.dom.NodeList decryptAndParse(oracle.security.crypto.core.SymmetricKey key)
                                     throws XEException
Decrypts the cipher value with the given key, and returns the decrypted value as XML.

Use this method if the encrypted data type is XML Element or element Content. If the EncryptedData element's parent node is not in the application's result node-set, use the method decryptAndParse(SymmetricKey key, boolean parentInNodeSet) instead, and pass false for the second argument.

Parameters:
key - The key to be used in the decryption.
Returns:
A NodeList containing the apex nodes of the decrypted XML.
Throws:
XESchemaException - If the value of the EncryptedData's Type attribute is not "http://www.w3.org/2001/04/xmlenc#Element" or "http://www.w3.org/2001/04/xmlenc#Content".
XEException
Since:
2.0

decryptAndParse

public org.w3c.dom.NodeList decryptAndParse(boolean parentInNodeSet)
                                     throws XEException
Decrypts the cipher value and returns the decrypted value as XML. The decryption key is obtained by resolving the KeyInfo element. The decryption key for the bottom of the EncryptedData EncryptedKey chain is obtained from the KeyRetriever facility.

Use this method if the encrypted data type is XML Element or element Content.

Parameters:
parentInNodeSet - true if the parent of the EncryptedData element is in the application's result node-set (e.g., if the entire document is to be processed), otherwise false. This information is used in augmenting the decrypted XML's apex nodes with inherited attributes from the XML namespace.
Returns:
A NodeList containing the apex nodes of the decrypted XML.
Throws:
XESchemaException - If the value of the EncryptedData's Type attribute is not "http://www.w3.org/2001/04/xmlenc#Element" or "http://www.w3.org/2001/04/xmlenc#Content".
XEException
Since:
2.0

decryptAndParse

public org.w3c.dom.NodeList decryptAndParse()
                                     throws XEException
Decrypts the cipher value and returns the decrypted value as XML. The decryption key is obtained by resolving the KeyInfo element. The decryption key for the bottom of the EncryptedData EncryptedKey chain is obtained from the KeyRetriever facility.

Use this method if the encrypted data type is XML Element or element Content. If the EncryptedData element's parent node is not in the application's result node-set, use the method decryptAndParse(boolean parentInNodeSet) instead, and pass false for the second argument.

Returns:
A NodeList containing the apex nodes of the decrypted XML.
Throws:
XESchemaException - If the value of the EncryptedData's Type attribute is not "http://www.w3.org/2001/04/xmlenc#Element" or "http://www.w3.org/2001/04/xmlenc#Content".
XEException
Since:
2.0

decryptAndReplace

public static org.w3c.dom.Element decryptAndReplace(oracle.security.crypto.core.SymmetricKey key,
                                                    org.w3c.dom.Element encDataElement,
                                                    boolean parentInNodeSet)
                                             throws org.w3c.dom.DOMException,
                                                    XEException
This static method is used to decrypt the given EncryptedData element with the given key, and replaces the EncrypteData element with the decrypted XML result.

Use this method if the encrypted data type is XML Element or element Content.

Parameters:
key - The key to be used in the encryption.
encDataElement - The EncryptedData element to be decrypted.
parentInNodeSet - true if the parent of the EncryptedData element is in the application's result node-set (e.g., if the entire document is to be processed), otherwise false.
Returns:
The decrypted XML element or the element whose content was encrypted.
Throws:
XECipherException - If an error occurs decrypting the data.
XESchemaException - If the EncryptedData element's Type attribute is inconsistent with the decrypt-and-replace operation.
org.w3c.dom.DOMException
XEException

decryptAndReplace

public static org.w3c.dom.Element decryptAndReplace(oracle.security.crypto.core.SymmetricKey key,
                                                    org.w3c.dom.Element encDataElement)
                                             throws org.w3c.dom.DOMException,
                                                    XEException
This static method is used to decrypt the given EncryptedData element with the given key, and replaces the EncrypteData element with the decrypted XML result.

Use this method if the encrypted data type is XML Element or element Content. If the EncryptedData element's parent node is not in the application's result node-set, use the method decryptAndReplace(Element encDataElement, boolean parentInNodeSet) instead, and pass false for the second argument.

Parameters:
key - The key to be used in the encryption.
encDataElement - The EncryptedData element to be decrypted.
Returns:
The decrypted XML element or the element whose content was encrypted.
Throws:
XECipherException - If an error occurs decrypting the data.
XESchemaException - If the EncryptedData element's Type attribute is inconsistent with the decrypt-and-replace operation.
org.w3c.dom.DOMException
XEException

decryptAndReplace

public static org.w3c.dom.Element decryptAndReplace(org.w3c.dom.Element encDataElement)
                                             throws org.w3c.dom.DOMException,
                                                    XEException
This static method is used to decrypt the given EncryptedData element with the given key, and replaces the EncrypteData element with the decrypted XML result. The decryption key is obtained by resolving the KeyInfo element. The decryption key for the bottom of the EncryptedData/EncryptedKey chain is obtained using the KeyRetriever facility.

Use this method if the encrypted data type is XML Element or element Content. If the EncryptedData element's parent node is not in the application's result node-set, use the method decryptAndReplace(Element encDataElement, boolean parentInNodeSet) instead, and pass false for the second argument.

Parameters:
encDataElement - The EncryptedData element to be decrypted.
Returns:
The decrypted XML element or the element whose content was encrypted.
Throws:
org.w3c.dom.DOMException
XEException
Since:
1.2

decryptAndReplace

public static org.w3c.dom.Element decryptAndReplace(org.w3c.dom.Element encDataElement,
                                                    boolean parentInNodeSet)
                                             throws org.w3c.dom.DOMException,
                                                    XEException
This static method is used to decrypt the given EncryptedData element with the given key, and replaces the EncrypteData element with the decrypted XML result. The decryption key is obtained by resolving the KeyInfo element. The decryption key for the bottom of the EncryptedData/EncryptedKey chain is obtained using the KeyRetriever facility. Use this method if the encrypted data type is XML Element or Element Content.
Parameters:
encDataElement - The EncryptedData element to be decrypted.
parentInNodeSet - true if the parent of the EncryptedData element is in the application's result node-set (e.g., if the entire document is to be processed), otherwise false.
Returns:
The decrypted XML element or the element whose content was encrypted.
Throws:
org.w3c.dom.DOMException
XEException
Since:
2.0

Oracle Security Developer Tools XML Security Java API Reference
10g (10.1.4.0.1)

B28178-01


Copyright © 2005 ,2006 , Oracle. All rights reserved.