|
Oracle Fusion Middleware XML Security Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10680-05 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.security.xmlsec.util.XMLNode
oracle.security.xmlsec.util.XMLElement
oracle.security.xmlsec.enc.XEEncryptedObject
oracle.security.xmlsec.enc.XEEncryptedData
public class XEEncryptedData
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:
XMLURI.obj_Element
XMLURI.obj_Content
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 | |
---|---|
DecryptInputStream |
createDecryptInputStream(javax.crypto.SecretKey key, java.io.InputStream cipherIs) FOR INTERNAL USE. |
EncryptOutputStream |
createEncryptOutputStream(javax.crypto.SecretKey key, byte[] iv, java.io.OutputStream os) FOR INTERNAL USE. |
byte[] |
decrypt() Decrypts the cipher value and returns the decrypted value in bytes. |
byte[] |
decrypt(javax.crypto.SecretKey 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(javax.crypto.SecretKey key) Decrypts the cipher value with the given key, and returns the decrypted value as XML. |
org.w3c.dom.NodeList |
decryptAndParse(javax.crypto.SecretKey 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(javax.crypto.SecretKey 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(javax.crypto.SecretKey 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. |
java.io.InputStream |
decryptToStream(javax.crypto.SecretKey key) |
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, javax.crypto.SecretKey key) Encrypts an array of bytes using block cipher. |
byte[] |
encrypt(byte[] bytes, javax.crypto.SecretKey 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, javax.crypto.SecretKey key) Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key. |
byte[] |
encrypt(org.w3c.dom.Element element, javax.crypto.SecretKey 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, javax.crypto.SecretKey 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, javax.crypto.SecretKey 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. |
void |
encryptTo(org.w3c.dom.Element element, javax.crypto.SecretKey key, byte[] iv, java.io.OutputStream os) Encrypts an XML Element or XML Element Content using block cipher with the given symmetric key and the initialization vector. |
java.lang.String |
getDecryptedDataInformation() returns the decrypted data information, if the property xml.debug.decrypt is set. |
java.lang.String |
getEncryptedDataInformation() returns the encrypted data information, if the property xml.debug.enc is set. |
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.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 |
---|
public XEEncryptedData(org.w3c.dom.Element encData) throws org.w3c.dom.DOMException
XEEncryptedData
instance from the given EncryptedData element.
encData
- An EncryptedData element.org.w3c.dom.DOMException
public XEEncryptedData(org.w3c.dom.Element encData, java.lang.String systemId) throws org.w3c.dom.DOMException
XEEncryptedData
instance from the given EncryptedData element.
encData
- An EncryptedData element.systemId
- The URI string system ID for the XEEncryptedData
.org.w3c.dom.DOMException
Method Detail |
---|
public static XEEncryptedData newInstance(java.lang.String id) throws org.w3c.dom.DOMException
id
- The optional ID name for this EncryptedData element.org.w3c.dom.DOMException
public static XEEncryptedData newInstance(java.lang.String id, java.lang.String dataType) throws org.w3c.dom.DOMException
id
- The optional ID name for this EncryptedData element.dataType
- An optional URI identifying the type of the data to be encrypted.org.w3c.dom.DOMException
public static XEEncryptedData newInstance(org.w3c.dom.Document doc, java.lang.String id) throws org.w3c.dom.DOMException
doc
- An XML Document to be used as the owner document of this EncryptedData element.id
- The optional ID name for this EncryptedData element.org.w3c.dom.DOMException
public static XEEncryptedData newInstance(org.w3c.dom.Document doc, java.lang.String id, java.lang.String dataType) throws org.w3c.dom.DOMException
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.org.w3c.dom.DOMException
public void setNonce(byte[] nonce)
nonce
- The nonce value.public byte[] getNonce()
setNonce
.null
if not specified.public int getNonceLength()
0
if a nonce is not used in the encryption.public void replaceElement(org.w3c.dom.Element element, boolean contentOnly) throws org.w3c.dom.DOMException
element
- The XML element to be replaced.contentOnly
- If true
, only the content of the element will be replaced, otherwise the element itself.org.w3c.dom.DOMException
public byte[] encrypt(byte[] bytes, javax.crypto.SecretKey key, byte[] iv) throws XESchemaException, XECipherException
bytes
- The bytes to be encrypted.key
- The key to be used in the encryption.iv
- The initialization vector.XESchemaException
XECipherException
public EncryptOutputStream createEncryptOutputStream(javax.crypto.SecretKey key, byte[] iv, java.io.OutputStream os) throws XESchemaException, XECipherException, java.io.IOException
key
-iv
-os
-XESchemaException
XECipherException
java.io.IOException
public byte[] encrypt(byte[] bytes, byte[] iv) throws XEException
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.
bytes
- The plain bytes to be encrypted.iv
- The initialization vector.XEException
public byte[] encrypt(byte[] bytes, javax.crypto.SecretKey key) throws XESchemaException, XECipherException
bytes
- The bytes to be encrypted.key
- The key to be used in the encryption.XESchemaException
XECipherException
public byte[] encrypt(byte[] bytes) throws XEException
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.
bytes
- The bytes to be encrypted.XEException
public byte[] encrypt(org.w3c.dom.Element element, javax.crypto.SecretKey key, byte[] iv) throws XESchemaException, XECipherException
Note: The Type URI must be set before using this method.
element
- The XML element to be encrypted.key
- The key to be used in the encryption.iv
- The initialization vector.XESchemaException
XECipherException
public void encryptTo(org.w3c.dom.Element element, javax.crypto.SecretKey key, byte[] iv, java.io.OutputStream os) throws XESchemaException, XECipherException
element
-key
-iv
-os
- Encrypted bytes are written into this output streamXESchemaException
XECipherException
public byte[] encrypt(org.w3c.dom.Element element, byte[] iv) throws XEException
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.
element
- The XML element to be encrypted.iv
- The initialization vector.XEException
public byte[] encrypt(org.w3c.dom.Element element, javax.crypto.SecretKey key) throws XESchemaException, XECipherException
Note: The Type URI must be set before using this method.
element
- The XML element to be encrypted.key
- The key to be used in the encryption.XESchemaException
XECipherException
public byte[] encrypt(org.w3c.dom.Element element) throws XEException
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.
element
- The XML element to be encrypted.XEException
public static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element, javax.crypto.SecretKey key, byte[] iv, XEEncryptedData encData) throws XESchemaException, XECipherException
Note: The Type URI must be set before using this method.
element
- The XML element to be encrypted.key
- The key to be used in the encryption.iv
- The initialization vector.XESchemaException
XECipherException
public static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element, byte[] iv, XEEncryptedData encData) throws XEException
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.
element
- The XML element to be encrypted.iv
- The initialization vector.XEException
public static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element, javax.crypto.SecretKey key, XEEncryptedData encData) throws XESchemaException, XECipherException
Note: The Type URI must be set before using this method.
element
- The XML element to be encrypted.key
- The key to be used in the encryption.XESchemaException
XECipherException
public static XEEncryptedData encryptAndReplace(org.w3c.dom.Element element, XEEncryptedData encData) throws XEException
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.
element
- The XML element to be encrypted.XEException
public byte[] decrypt(javax.crypto.SecretKey key) throws XESchemaException, XECipherException
Use this method if the encrypted data type is not XML Element or element Content.
XESchemaException
XECipherException
public java.io.InputStream decryptToStream(javax.crypto.SecretKey key) throws XESchemaException, XECipherException
XESchemaException
XECipherException
public DecryptInputStream createDecryptInputStream(javax.crypto.SecretKey key, java.io.InputStream cipherIs) throws XESchemaException, XECipherException
key
-cipherValue
-XESchemaException
XECipherException
public byte[] decrypt() throws XEException
KeyRetriever
facility.
Use this method if the encrypted data type is not XML Element or element Content.
XEException
public org.w3c.dom.NodeList decryptAndParse(javax.crypto.SecretKey key, boolean parentInNodeSet) throws XEException
Use this method if the encrypted data type is XML Element or element Content.
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.NodeList
containing the apex nodes of the decrypted XML.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
public org.w3c.dom.NodeList decryptAndParse(javax.crypto.SecretKey key) throws XEException
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(SecretKey key, boolean parentInNodeSet)
instead, and pass false
for the second argument.
key
- The key to be used in the decryption.NodeList
containing the apex nodes of the decrypted XML.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
public org.w3c.dom.NodeList decryptAndParse(boolean parentInNodeSet) throws XEException
KeyRetriever
facility.
Use this method if the encrypted data type is XML Element or element Content.
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.NodeList
containing the apex nodes of the decrypted XML.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
public org.w3c.dom.NodeList decryptAndParse() throws XEException
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.
NodeList
containing the apex nodes of the decrypted XML.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
public static org.w3c.dom.Element decryptAndReplace(javax.crypto.SecretKey key, org.w3c.dom.Element encDataElement, boolean parentInNodeSet) throws org.w3c.dom.DOMException, XEException
Use this method if the encrypted data type is XML Element or element Content.
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
.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
public static org.w3c.dom.Element decryptAndReplace(javax.crypto.SecretKey key, org.w3c.dom.Element encDataElement) throws org.w3c.dom.DOMException, XEException
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.
key
- The key to be used in the encryption.encDataElement
- The EncryptedData element to be decrypted.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
public static org.w3c.dom.Element decryptAndReplace(org.w3c.dom.Element encDataElement) throws org.w3c.dom.DOMException, XEException
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.
encDataElement
- The EncryptedData element to be decrypted.org.w3c.dom.DOMException
XEException
public static org.w3c.dom.Element decryptAndReplace(org.w3c.dom.Element encDataElement, boolean parentInNodeSet) throws org.w3c.dom.DOMException, XEException
KeyRetriever
facility. Use this method if the encrypted data type is XML Element or Element Content.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
.org.w3c.dom.DOMException
XEException
public java.lang.String getDecryptedDataInformation()
public java.lang.String getEncryptedDataInformation()
|
Oracle Fusion Middleware XML Security Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10680-05 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |