Skip navigation links

Oracle Fusion Middleware XML Security Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10680-03


oracle.security.xmlsec.dsig
Class XSObject

java.lang.Object
  extended by oracle.security.xmlsec.util.XMLNode
      extended by oracle.security.xmlsec.util.XMLElement
          extended by oracle.security.xmlsec.dsig.XSObject

All Implemented Interfaces:
Referable

public class XSObject
extends XMLElement
implements Referable

The XML-DSIG Object element.

A XSObject is typically used to enclose a SignatureProperties, Manifest or any other XML or non-XML data object(s) that are to be signed using an enveloping signature. This is accomplised by adding an Object to a Signature structure and making that Object the target of a Reference within the Signature's SignedInfo.

For example:


                XSSignature sig = XSSignature.newInstance("MySignature");
                Document doc = sig.getOwnerDocument();
        

To enclose an arbitrary XML element, create a XSObject and append the element to it:


                Element foo = doc.createElementNS("http://example.com/ns", "Foo");
                XSObject obj = sig.createObject();
                obj.setId("Foo_1");
                obj.appendChild(foo);
                sig.addObject(obj);
        

To enclose an arbitrary non-XML object, append its base64-encoded bytes as a text node:


                File f = new File("/home/john/me.jpeg");
                byte[] jpeg = new byte[(int)f.length()];
                new DataInputStream(new FileInputStream(f)).readFully(jpeg);

                XSObject obj = sig.createObject("MyPicture", "image/jped", "base64");
                obj.appendChild(doc.createTextNode(Base64.toBase64(jpeg)));
                sig.addObject(obj);
        
See Also:
XSSignature.createObject(), XSSignature.addObject(oracle.security.xmlsec.dsig.XSObject)

Field Summary

 

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

 

Constructor Summary
XSObject(org.w3c.dom.Document owner)
          Creates a new XSObject instance.
XSObject(org.w3c.dom.Document owner, java.lang.String id)
          Creates a new XSObject instance.
XSObject(org.w3c.dom.Document owner, java.lang.String id, java.lang.String mimeType, java.lang.String encoding)
          Creates a new XSObject instance.
XSObject(org.w3c.dom.Element element)
          Creates a new XSObject instance from the given Element node.
XSObject(org.w3c.dom.Element element, java.lang.String systemId)
          Creates a new XSObject instance from the given Element node.

 

Method Summary
 java.lang.String getEncoding()
          Returns the value of the Encoding attribute of this Object.
 java.lang.String getId()
          Returns the value of the Id attribute of this Object.
 java.lang.String getMimeType()
          Returns the value of the MimeType attribute of this Object.
 java.lang.String getType()
          Returns the URI defined in the XML-DSIG space to identify the Object element ("http://www.w3.org/2000/09/xmldsig#Object").
 void setEncoding(java.lang.String encoding)
          Sets the Encoding attribute of this Object.
 void setId(java.lang.String id)
          Sets the Id attribute of this Object.
 void setMimeType(java.lang.String mimeType)
          Sets the MimeType attribute of this Object.

 

Methods inherited from class oracle.security.xmlsec.util.XMLElement
addNSPrefixAttr, addNSPrefixAttr, addNSPrefixAttrDefault, addNSPrefixAttrDefault, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getChildElementsByTagName, getChildElementsByTagName, getChildElementsByTagNameNS, getChildElementsByTagNameNS, getDefaultNSPrefix, getElement, 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

XSObject

public XSObject(org.w3c.dom.Element element)
         throws org.w3c.dom.DOMException
Creates a new XSObject instance from the given Element node.
Parameters:
element - An Element node in the XML document that conforms to the XML-DSIG Object schema.
Throws:
org.w3c.dom.DOMException

XSObject

public XSObject(org.w3c.dom.Element element,
                java.lang.String systemId)
         throws org.w3c.dom.DOMException
Creates a new XSObject instance from the given Element node.
Parameters:
element - An Element node in the XML document that conforms to the XML-DSIG Object schema.
systemId - The URI string system ID for this element.
Throws:
org.w3c.dom.DOMException
Since:
2.0
See Also:
XMLNode.setSystemId(java.lang.String)

XSObject

public XSObject(org.w3c.dom.Document owner)
         throws org.w3c.dom.DOMException
Creates a new XSObject instance.
Parameters:
owner - The owner document of the new XSObject
Throws:
org.w3c.dom.DOMException

XSObject

public XSObject(org.w3c.dom.Document owner,
                java.lang.String id)
         throws org.w3c.dom.DOMException
Creates a new XSObject instance.
Parameters:
owner - The owner document of the new XSObject.
id - An optional string ID name for this XSObject structure.
Throws:
org.w3c.dom.DOMException

XSObject

public XSObject(org.w3c.dom.Document owner,
                java.lang.String id,
                java.lang.String mimeType,
                java.lang.String encoding)
         throws org.w3c.dom.DOMException
Creates a new XSObject instance.
Parameters:
owner - The owner document of the new XSObject.
id - An optional string ID name for this XSObject structure.
mimeType - An optional string describing the data within the object, as defined in the MIME specification.
encoding - An optional URI identifying the enclosed object's encoding method.
Throws:
org.w3c.dom.DOMException

Method Detail

setMimeType

public void setMimeType(java.lang.String mimeType)
                 throws org.w3c.dom.DOMException
Sets the MimeType attribute of this Object.
Parameters:
mimeType - A string describing the MIME type of the data within this Object.
Throws:
org.w3c.dom.DOMException

getMimeType

public java.lang.String getMimeType()
Returns the value of the MimeType attribute of this Object.
Returns:
A string describing the MIME type of the data within this Object, or null if the attribute is missing.

setEncoding

public void setEncoding(java.lang.String encoding)
                 throws org.w3c.dom.DOMException
Sets the Encoding attribute of this Object.
Parameters:
encoding - A URI identifying the encoding method of the enclosed object.
Throws:
org.w3c.dom.DOMException

getEncoding

public java.lang.String getEncoding()
Returns the value of the Encoding attribute of this Object.
Returns:
A URI identifying the encoding method of the enclosed object, or null if the attribute is missing.

setId

public void setId(java.lang.String id)
           throws org.w3c.dom.DOMException
Sets the Id attribute of this Object.
Specified by:
setId in interface Referable
Parameters:
id - The ID name of this Object.
Throws:
org.w3c.dom.DOMException

getId

public java.lang.String getId()
Returns the value of the Id attribute of this Object.
Specified by:
getId in interface Referable
Returns:
A string containing the ID name of this Object, or null if the attribute is missing.

getType

public java.lang.String getType()
Returns the URI defined in the XML-DSIG space to identify the Object element ("http://www.w3.org/2000/09/xmldsig#Object").
Specified by:
getType in interface Referable
Returns:
A URI identifying the type of this object, or null if none is defined.
See Also:
XMLURI.obj_Object

Skip navigation links

Oracle Fusion Middleware XML Security Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10680-03


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