|
Oracle Fusion Middleware XML Security Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10680-03 |
||||||||
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.dsig.XSObject
public class XSObject
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);
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.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 XSObject(org.w3c.dom.Element element) throws org.w3c.dom.DOMException
XSObject
instance from the given Element node.
element
- An Element node in the XML document that conforms to the XML-DSIG Object schema.org.w3c.dom.DOMException
public XSObject(org.w3c.dom.Element element, java.lang.String systemId) throws org.w3c.dom.DOMException
XSObject
instance from the given Element node.
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.org.w3c.dom.DOMException
XMLNode.setSystemId(java.lang.String)
public XSObject(org.w3c.dom.Document owner) throws org.w3c.dom.DOMException
XSObject
instance.
owner
- The owner document of the new XSObject
org.w3c.dom.DOMException
public XSObject(org.w3c.dom.Document owner, java.lang.String id) throws org.w3c.dom.DOMException
XSObject
instance.
owner
- The owner document of the new XSObject
.id
- An optional string ID name for this XSObject structure.org.w3c.dom.DOMException
public XSObject(org.w3c.dom.Document owner, java.lang.String id, java.lang.String mimeType, java.lang.String encoding) throws org.w3c.dom.DOMException
XSObject
instance.
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.org.w3c.dom.DOMException
Method Detail |
---|
public void setMimeType(java.lang.String mimeType) throws org.w3c.dom.DOMException
mimeType
- A string describing the MIME type of the data within this Object.org.w3c.dom.DOMException
public java.lang.String getMimeType()
null
if the attribute is missing.public void setEncoding(java.lang.String encoding) throws org.w3c.dom.DOMException
encoding
- A URI identifying the encoding method of the enclosed object.org.w3c.dom.DOMException
public java.lang.String getEncoding()
null
if the attribute is missing.public void setId(java.lang.String id) throws org.w3c.dom.DOMException
setId
in interface Referable
id
- The ID name of this Object.org.w3c.dom.DOMException
public java.lang.String getId()
getId
in interface Referable
null
if the attribute is missing.public java.lang.String getType()
getType
in interface Referable
null
if none is defined.XMLURI.obj_Object
|
Oracle Fusion Middleware XML Security Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10680-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |