Oracle Security Developer Tools XML Security Java API Reference
10g Release 2 (10.1.2.0.2)

B15571-01


oracle.security.xmlsec.enc
Class XEEncryptedObject

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

Direct Known Subclasses:
XEEncryptedData, XEEncryptedKey

public abstract class XEEncryptedObject
extends XMLElement

Abstract class representing the XML-ENC EncryptedType structure. This is the base class for the XML-ENC encrypted elements EncryptedData and EncryptedKey.

The XEEncryptedObject's EncryptionMethod specifies the encryption or key wrapping algorithm to be used. Standard algorithm URI constants can be found in XMLURI, including:

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:
XEEncryptionMethod, XEEncryptedData, XEEncryptedKey

Field Summary

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

Constructor Summary
protected XEEncryptedObject(org.w3c.dom.Document doc, java.lang.String tagName)
Create a new XEEncryptedObject instance from the given XML Document context and the tagName.
protected XEEncryptedObject(org.w3c.dom.Element encElement)
Create a new XEEncryptedObject instance from the given EncryptedData or EncryptedKey element.
protected XEEncryptedObject(org.w3c.dom.Element encElement, java.lang.String systemId)
Create a new XEEncryptedObject instance from the given EncryptedData or EncryptedKey element.

Method Summary
XECipherData createCipherData()
Create a new XECipherData instance.
XECipherData createCipherData(byte[] cipherValue)
Create a new XECipherData instance with the given cipher value.
XECipherReference createCipherReference(java.lang.String uri)
Create a new XECipherReference instance with the given URI.
XEDataReference createDataReference(java.lang.String uri)
Create a new XEDataReference instance with the given URI.
XEEncryptionMethod createEncryptionMethod(java.lang.String algURI)
Create a new XEEncryptionMethod instance with given URI identifying the encryption algorithm to be used in encrypting data or key.
XEEncryptionProperties createEncryptionProperties()
Create a new XEEncryptionProperties instance.
XEEncryptionProperties createEncryptionProperties(java.lang.String id)
Create a new XEEncryptionProperties instance.
XEEncryptionProperty createEncryptionProperty()
Create a new XEEncryptionProperty instance.
XEEncryptionProperty createEncryptionProperty(java.lang.String id)
Create a new XEEncryptionProperty instance.
XEKeyInfo createKeyInfo()
Create a new KeyInfo instance.
XEKeyInfo createKeyInfo(java.lang.String id)
Create a new XEKeyInfo instance with the given Id.
XEKeyReference createKeyReference(java.lang.String uri)
Create a new XEKeyReference instance with the given URI.
OriginatorKeyInfo createOriginatorKeyInfo()
Create a new OriginatorKeyInfo instance for using in key agreement.
RecipientKeyInfo createRecipientKeyInfo()
Create a new RecipientKeyInfo instance for using in key agreement.
XECipherData getCipherData()
Return the XECipherData object for this XEEncryptedObject.
java.lang.String getDataType()
Get the value of the Type attribute for this EncryptedData element.
Key getDecryptionKey()
Get the decryption key by resolving the XEKeyInfo object.
java.lang.String getEncoding()
Returns the Encoding attribute value.
Key getEncryptionKey()
Geting the encryption key from the KeyInfo child element using the KeyRetriever facility.
XEEncryptionMethod getEncryptionMethod()
Return the XEEncryptionMethodXEEncryptedObject.
XEEncryptionProperties getEncryptionProperties()
Return the XEEncryptionProperties object for this XEEncryptedObject.
java.lang.String getId()
Returns the value of the Id attribute for this EncryptedData or EncryptedKey element.
static XEEncryptedObject getInstance(org.w3c.dom.Element encElement)
Create a new XEEncryptedObject instance from the given XML Element.
static XEEncryptedObject getInstance(org.w3c.dom.Element encElement, java.lang.String systemId)
Create a new XEEncryptedObject instance from the given XML Element.
XEKeyInfo getKeyInfo()
Return the XEKeyInfo object for this XEEncryptedObject.
java.lang.String getMimeType()
Returns the MimeType attribute value for this EncryptedData element.
void setCipherData(XECipherData cipherData)
Set the CipherData child element for this XEEncryptedObject.
void setDataType(java.lang.String typeURI)
Set the Type attribute for this EncryptedData element.
void setEncoding(java.lang.String encoding)
Set the Encoding attribute which decribe how the media data encrypted was encoded (for example, "base64").
void setEncryptionMethod(XEEncryptionMethod encMethod)
Sets the EncryptionMethod object in this structure.
void setEncryptionProperties(XEEncryptionProperties encProps)
Set the EncryptionProperties child element for this XEEncryptedObject.
void setId(java.lang.String id)
Set the Id attribute for this EncryptedData or EncryptedKey element.
void setKeyInfo(XEKeyInfo keyInfo)
Set the ds:KeyInfo child element for this XEEncryptedObject.
void setMimeType(java.lang.String mimeType)
Set the MimeType attribute which decribes the media type of the data encrypted.

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

XEEncryptedObject

protected XEEncryptedObject(org.w3c.dom.Element encElement)
                     throws org.w3c.dom.DOMException
Create a new XEEncryptedObject instance from the given EncryptedData or EncryptedKey element.
Parameters:
encElement - An EncryptedData or EncryptedKey element.

XEEncryptedObject

protected XEEncryptedObject(org.w3c.dom.Element encElement,
                            java.lang.String systemId)
                     throws org.w3c.dom.DOMException
Create a new XEEncryptedObject instance from the given EncryptedData or EncryptedKey element.
Parameters:
encElement - An EncryptedData or EncryptedKey element.
systemId - The URI string system ID for the XEEncryptedObject.
Since:
2.0

XEEncryptedObject

protected XEEncryptedObject(org.w3c.dom.Document doc,
                            java.lang.String tagName)
                     throws org.w3c.dom.DOMException
Create a new XEEncryptedObject instance from the given XML Document context and the tagName.
Parameters:
doc - A XML Document to be used as the owner document of this element.
tagName - The local name of this XML-Enc element.

Method Detail

getInstance

public static XEEncryptedObject getInstance(org.w3c.dom.Element encElement)
                                     throws org.w3c.dom.DOMException
Create a new XEEncryptedObject instance from the given XML Element.
Parameters:
encElement - An EncryptedData or EncryptedKey element.
Returns:
A new XEEncryptedObject instance
Throws:
java.lang.IllegalArgumentException - If encElement is not a supported EncryptedObject type.
org.w3c.dom.DOMException - If an error occurs parsing the given element.

getInstance

public static XEEncryptedObject getInstance(org.w3c.dom.Element encElement,
                                            java.lang.String systemId)
                                     throws org.w3c.dom.DOMException
Create a new XEEncryptedObject instance from the given XML Element.
Parameters:
encElement - An EncryptedData or EncryptedKey element.
systemId - The URI string system ID for the XEEncryptedObject.
Returns:
A new XEEncryptedObject instance.
Throws:
java.lang.IllegalArgumentException - If encElement is not a supported EncryptedObject type.
org.w3c.dom.DOMException - If an error occurs parsing the given element.
Since:
2.0

setId

public void setId(java.lang.String id)
           throws org.w3c.dom.DOMException
Set the Id attribute for this EncryptedData or EncryptedKey element.
Parameters:
id - The Id string for this element.
Throws:
org.w3c.dom.DOMException

getId

public java.lang.String getId()
Returns the value of the Id attribute for this EncryptedData or EncryptedKey element.
Returns:
The Id for this element, or null if it is missing.

setDataType

public void setDataType(java.lang.String typeURI)
                 throws org.w3c.dom.DOMException
Set the Type attribute for this EncryptedData element.
Parameters:
typeURI - The URI identifying the type of the data to be encrypted.
Throws:
org.w3c.dom.DOMException

getDataType

public java.lang.String getDataType()
Get the value of the Type attribute for this EncryptedData element.
Returns:
The URI identifying the type of the data to be encrypted, or null if it is missing.

setMimeType

public void setMimeType(java.lang.String mimeType)
                 throws org.w3c.dom.DOMException
Set the MimeType attribute which decribes the media type of the data encrypted. This attribute may not necessary if it is already bound to the identifier in the Type attribute. In particular if the data is of type Element or Element Content.
Parameters:
mimeType - A string with a value defined by MIME.
Throws:
org.w3c.dom.DOMException
Since:
1.2

getMimeType

public java.lang.String getMimeType()
Returns the MimeType attribute value for this EncryptedData element.
Returns:
A string that decribes the media type of the data encrypted.
Since:
1.2

setEncoding

public void setEncoding(java.lang.String encoding)
                 throws org.w3c.dom.DOMException
Set the Encoding attribute which decribe how the media data encrypted was encoded (for example, "base64"). This attribute is purely advisory.
Parameters:
encoding - A string describing the encoding type.
Throws:
org.w3c.dom.DOMException
Since:
1.2

getEncoding

public java.lang.String getEncoding()
Returns the Encoding attribute value.
Returns:
A string describing the encoding type.
Since:
1.2

createEncryptionMethod

public XEEncryptionMethod createEncryptionMethod(java.lang.String algURI)
                                          throws org.w3c.dom.DOMException
Create a new XEEncryptionMethod instance with given URI identifying the encryption algorithm to be used in encrypting data or key. To append this new XEEncryptionMethod to this EncryptedData or EncryptedKey structure, use the method setEncryptionMethod(XEEncryptionMethod).
Parameters:
algURI - The URI string identifying the encryption algorithm.
Returns:
An XEEncryptionMethod object.
Throws:
org.w3c.dom.DOMException

createKeyInfo

public XEKeyInfo createKeyInfo()
                        throws org.w3c.dom.DOMException
Create a new KeyInfo instance. To append this new KeyInfo to this EncryptedData or EncryptedKey structure, use the method setKeyInfo(XEKeyInfo).
Returns:
A KeyInfo object.
Throws:
org.w3c.dom.DOMException

createKeyInfo

public XEKeyInfo createKeyInfo(java.lang.String id)
                        throws org.w3c.dom.DOMException
Create a new XEKeyInfo instance with the given Id. To append this new KeyInfo to this EncryptedData or EncryptedKey structure, use the method setKeyInfo(XEKeyInfo).
Parameters:
id - The Id attribute for this ds:KeyInfo element.
Returns:
An XEKeyInfo object.
Throws:
org.w3c.dom.DOMException

createOriginatorKeyInfo

public OriginatorKeyInfo createOriginatorKeyInfo()
                                          throws org.w3c.dom.DOMException
Create a new OriginatorKeyInfo instance for using in key agreement. To append this new OriginatorKeyInfo to an AgreementMethod structure, use the method AgreementMethod.setOriginatorKeyInfo(OriginatorKeyInfo).
Returns:
An OriginatorKeyInfo object.
Throws:
org.w3c.dom.DOMException

createRecipientKeyInfo

public RecipientKeyInfo createRecipientKeyInfo()
                                        throws org.w3c.dom.DOMException
Create a new RecipientKeyInfo instance for using in key agreement. To append this new RecipientKeyInfo to an AgreementMethod structure, use the method AgreementMethod.setRecipientKeyInfo(RecipientKeyInfo).
Returns:
A RecipientKeyInfo object.
Throws:
org.w3c.dom.DOMException

createDataReference

public XEDataReference createDataReference(java.lang.String uri)
                                    throws org.w3c.dom.DOMException
Create a new XEDataReference instance with the given URI. To append this new XEDataReference to a XEEncryptedKey structure, use the method XEEncryptedKey.addReference(XEReference).
Parameters:
uri - The URI for the XEEncryptedData element referenced.
Returns:
An XEDataReference object.
Throws:
org.w3c.dom.DOMException

createKeyReference

public XEKeyReference createKeyReference(java.lang.String uri)
                                  throws org.w3c.dom.DOMException
Create a new XEKeyReference instance with the given URI. To append this new XEKeyReference to a XEEncryptedKey structure, use the method XEEncryptedKey.addReference(XEReference).
Parameters:
uri - The URI for the XEEncryptedKey element referenced.
Returns:
An XEKeyReference object.
Throws:
org.w3c.dom.DOMException

createCipherData

public XECipherData createCipherData(byte[] cipherValue)
                              throws org.w3c.dom.DOMException
Create a new XECipherData instance with the given cipher value. Use this method only when the cipher value will be stored in an internal CipherValue child element of this CipherData element. To append this new XECipherData to this EncryptedData or EncryptedKey structure, use the method setCipherData(XECipherData).
Parameters:
cipherValue - The bytes of the CipherValue.
Returns:
An XECipherData instance.
Throws:
org.w3c.dom.DOMException

createCipherData

public XECipherData createCipherData()
                              throws org.w3c.dom.DOMException
Create a new XECipherData instance. To append this new XECipherData to this EncryptedData or EncryptedKey structure, use the method setCipherData(XECipherData).
Returns:
An XECipherData instance.
Throws:
org.w3c.dom.DOMException

createCipherReference

public XECipherReference createCipherReference(java.lang.String uri)
                                        throws org.w3c.dom.DOMException
Create a new XECipherReference instance with the given URI. To append this new XECipherReference to a XECipherData structure, use the method XECipherData.setCipherReference(XECipherReference).
Parameters:
uri - A URI identifying a source containing the cipher value.
Returns:
An XECipherReference instance.
Throws:
org.w3c.dom.DOMException

createEncryptionProperties

public XEEncryptionProperties createEncryptionProperties()
                                                  throws org.w3c.dom.DOMException
Create a new XEEncryptionProperties instance. To append this new XEEncryptionProperties to this EncryptedData or EncryptedKey structure, use the method setEncryptionProperties(XEEncryptionProperties).
Returns:
An XEEncryptionProperties instance.
Throws:
org.w3c.dom.DOMException

createEncryptionProperties

public XEEncryptionProperties createEncryptionProperties(java.lang.String id)
                                                  throws org.w3c.dom.DOMException
Create a new XEEncryptionProperties instance. To append this new XEEncryptionProperties to this EncryptedData or EncryptedKey structure, use the method setEncryptionProperties(XEEncryptionProperties).
Parameters:
id - The Id attribute for this EncryptionProperties element.
Returns:
An XEEncryptionProperties instance.
Throws:
org.w3c.dom.DOMException

createEncryptionProperty

public XEEncryptionProperty createEncryptionProperty()
                                              throws org.w3c.dom.DOMException
Create a new XEEncryptionProperty instance. To add this new XEEncryptionProperty to a XEEncryptionProperties structure, use the method XEEncryptionProperties.addEncryptionProperty(XEEncryptionProperty).
Returns:
An XEEncryptionProperty instance.
Throws:
org.w3c.dom.DOMException

createEncryptionProperty

public XEEncryptionProperty createEncryptionProperty(java.lang.String id)
                                              throws org.w3c.dom.DOMException
Create a new XEEncryptionProperty instance. To add this new XEEncryptionProperty to a XEEncryptionProperties structure, use the method XEEncryptionProperties.addEncryptionProperty(XEEncryptionProperty).
Parameters:
id - The Id attribute for this EncryptionProperty element.
Returns:
An XEEncryptionProperty instance.
Throws:
org.w3c.dom.DOMException

setEncryptionMethod

public void setEncryptionMethod(XEEncryptionMethod encMethod)
                         throws org.w3c.dom.DOMException
Sets the EncryptionMethod object in this structure.
Parameters:
encMethod - An XEEncryptionMethod instance.
Throws:
org.w3c.dom.DOMException

getEncryptionMethod

public XEEncryptionMethod getEncryptionMethod()
Return the XEEncryptionMethodXEEncryptedObject.
Returns:
An XEEncryptionMethod object.

setKeyInfo

public void setKeyInfo(XEKeyInfo keyInfo)
                throws org.w3c.dom.DOMException
Set the ds:KeyInfo child element for this XEEncryptedObject.
Parameters:
keyInfo - An XEKeyInfo instance.
Throws:
org.w3c.dom.DOMException

getKeyInfo

public XEKeyInfo getKeyInfo()
Return the XEKeyInfo object for this XEEncryptedObject.
Returns:
An XEKeyInfo object.

setCipherData

public void setCipherData(XECipherData cipherData)
                   throws org.w3c.dom.DOMException
Set the CipherData child element for this XEEncryptedObject.
Parameters:
cipherData - An XECipherData instance.
Throws:
org.w3c.dom.DOMException

getCipherData

public XECipherData getCipherData()
Return the XECipherData object for this XEEncryptedObject.
Returns:
An XECipherData object.

setEncryptionProperties

public void setEncryptionProperties(XEEncryptionProperties encProps)
                             throws org.w3c.dom.DOMException
Set the EncryptionProperties child element for this XEEncryptedObject.
Parameters:
encProps - An XEEncryptionProperties instance.
Throws:
org.w3c.dom.DOMException

getEncryptionProperties

public XEEncryptionProperties getEncryptionProperties()
Return the XEEncryptionProperties object for this XEEncryptedObject.
Returns:
An XEEncryptionProperties object.

getEncryptionKey

public Key getEncryptionKey()
                     throws XEException
Geting the encryption key from the KeyInfo child element using the KeyRetriever facility. If no KeyInfo or EncryptionMethod is present, or if the encryption key cannot be retrieved, a XEException is thrown. This method should NOT be used if the encryption key is identified by an EncryptedKey element.
Returns:
The encryption key for this XEEncryptedObject.
Throws:
XEException
Since:
1.2

getDecryptionKey

public Key getDecryptionKey()
                     throws XEException
Get the decryption key by resolving the XEKeyInfo object. The decryption key for the bottom of the EncryptedData\EncryptedKey chain is from the KeyRetriever facility. If no KeyInfo or EncryptionMethod is present, or if the decryption key cannot be retrieved, a XEException is thrown.
Returns:
The decryption key for this XEEncryptedObject.
Throws:
XEException
Since:
1.2

Oracle Security Developer Tools XML Security Java API Reference
10g Release 2 (10.1.2.0.2)

B15571-01


Copyright © 2005 , Oracle. All rights reserved.