public abstract class Message extends XMLElement
xkms:MessageAbstractType element.| Modifier | Constructor and Description |
|---|---|
protected |
Message(org.w3c.dom.Document owner, java.lang.String tagName)
Creates a new
Message instance. |
protected |
Message(org.w3c.dom.Document owner, java.lang.String tagName, java.lang.String systemId)
Creates a new
Message instance. |
protected |
Message(org.w3c.dom.Element element)
Creates a new
Message instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
addMessageExtension(org.w3c.dom.Element msgExtension)
Creates a new
xkms:MessageExtension element in this message's owner document, and appends it to the message element. |
void |
clearSignature()
Removes any
dsig:Signature element(s) from this XKMS message. |
java.lang.String |
getId()
Returns the value of the
Id attribute for this message, or null if none is set. |
org.w3c.dom.NodeList |
getMessageExtensions()
Returns the
xkms:MessageExtension for this message, or null if none is present. |
byte[] |
getNonce()
Returns the
Nonce attribute for this message, or null if nonce is set. |
OpaqueClientData |
getOpaqueClientData()
Returns the
xkms:OpaqueClientData for this message, or null if none is present. |
java.lang.String |
getService()
Returns the value of the
Service attribute for this message, or null if none is set. |
XSSignature |
getSignature()
Returns the
dsig:Signature for this message, or null if none is present. |
protected void |
insertChild(org.w3c.dom.Element e, java.lang.String[] tag, java.lang.String[] ns)
Inserts a child element after any occurrences of the given elements.
|
protected void |
insertChild(XMLElement e, java.lang.String[] tag, java.lang.String[] ns)
Inserts a child element after any occurrences of the given elements.
|
protected void |
removeChildren(java.lang.String tag, java.lang.String ns)
Removes any child elements with the given tag name.
|
void |
setId(java.lang.String id)
Sets the
Id attribute for this message. |
void |
setNonce(byte[] nonce)
Sets the
Nonce attribute for this message. |
void |
setOpaqueClientData(OpaqueClientData opdata)
Creates a new
xkms:OpaqueClientData element in this message's owner document, and appends it to the message element. |
void |
setService(java.lang.String service)
Sets the
Service attribute for this message. |
XSSignature |
setSignature(java.lang.String signatureMethod, java.lang.String c14nMethod, java.lang.String digestMethod)
Creates a new
dsig:Signature element in this message's owner document, and appends it to the message element. |
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, setDefaultNSPrefixappendChild, 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, toStringXMLprotected Message(org.w3c.dom.Element element)
throws org.w3c.dom.DOMException
Message instance.element - An Element node in the XML document.org.w3c.dom.DOMExceptionprotected Message(org.w3c.dom.Document owner,
java.lang.String tagName)
throws org.w3c.dom.DOMException
Message instance.owner - The owner document of the new Message.tagName - The name of the element to be created; e.g. "LocateRequest" if this Message is to be a X-KISS LocateRequest mesage.org.w3c.dom.DOMExceptionprotected Message(org.w3c.dom.Document owner,
java.lang.String tagName,
java.lang.String systemId)
throws org.w3c.dom.DOMException
Message instance.owner - The owner document of the new Message..tagName - The name of the element to be created; e.g. "LocateRequest" if this Message is to be a X-KISS LocateRequest mesage.systemId - The URI string system ID for the Message.org.w3c.dom.DOMExceptionpublic void setId(java.lang.String id)
throws org.w3c.dom.DOMException
Id attribute for this message.id - A unique XKMS message identifier.org.w3c.dom.DOMExceptionpublic java.lang.String getId()
Id attribute for this message, or null if none is set.public void setService(java.lang.String service)
throws org.w3c.dom.DOMException
Service attribute for this message.service - The URI of the service to which the message is addressed.org.w3c.dom.DOMExceptionpublic java.lang.String getService()
Service attribute for this message, or null if none is set.public void setNonce(byte[] nonce)
throws org.w3c.dom.DOMException
Nonce attribute for this message.
The nonce bytes will be Base-64 encoded prior to setting the attribute value.
nonce - The nonce bytes.org.w3c.dom.DOMExceptionpublic byte[] getNonce()
Nonce attribute for this message, or null if nonce is set.
The Base-64 encoded nonce bytes will be decoded.
public XSSignature setSignature(java.lang.String signatureMethod, java.lang.String c14nMethod, java.lang.String digestMethod) throws org.w3c.dom.DOMException
dsig:Signature element in this message's owner document, and appends it to the message element. The created dsig:Signature includes a dsig:Reference to the enclosing document, and uses a Enveloped Signature transform to select this message element and its children.
If the Id attribute of the XKMS Message is not set prior to calling this method, a XPath Filter Transform is added to the dsig:Reference (which points to the enclosing document i.e. URI="") to select this message element and its children for signing.
It may be necessary to add a verification key or retrieval data to the signature using the XSSignature.createKeyInfo and XSSignature.setKeyInfo methods.
Once the signature and the message are complete, use one of the XSSignature.sign methods to compute the signature value.
signatureMethod - The URI identifying the signature algorithm to be used to sign the SignedInfo structure.c14nMethod - The URI identifying the canonicalization method to be applied to both the SignedInfo structure and the Reference target.digestMethod - The URI identifying the digest algorithm to be used for the dsig:Reference to this message element.XSSignature instance enclosing this message's newly created dsig:Signature child element.org.w3c.dom.DOMExceptionpublic XSSignature getSignature()
dsig:Signature for this message, or null if none is present.XSSignature instance enclosing this message's dsig:Signature element.public void addMessageExtension(org.w3c.dom.Element msgExtension)
throws org.w3c.dom.DOMException
xkms:MessageExtension element in this message's owner document, and appends it to the message element.msgExtension - The element to be wrapped in a xkms:MessageExtension element.org.w3c.dom.DOMExceptionpublic org.w3c.dom.NodeList getMessageExtensions()
xkms:MessageExtension for this message, or null if none is present.NodeList instance enclosing this message's xkms:MessageExtension elements or null.public void setOpaqueClientData(OpaqueClientData opdata) throws org.w3c.dom.DOMException
xkms:OpaqueClientData element in this message's owner document, and appends it to the message element.
Once the signature and the message are complete, use one of the XSSignature.sign methods to compute the signature value.
opdata - The xkms:OpaqueClientData element.org.w3c.dom.DOMExceptionpublic OpaqueClientData getOpaqueClientData()
xkms:OpaqueClientData for this message, or null if none is present.OpaqueClientData instance enclosing this message's xkms:OpaqueData elements or null.public void clearSignature()
dsig:Signature element(s) from this XKMS message. This method should be invoked by subclasses in any method that modifies the data over which the signature is to be calculated.protected void insertChild(XMLElement e, java.lang.String[] tag, java.lang.String[] ns) throws org.w3c.dom.DOMException
e - The child element to insert.tag - An array of element tag names after any occurrence of which the child element is to be inserted. The tags must be presented in the order in which they appear in the parent element's schema.ns - An array of namespace URIs corresponding to the tag names in the tag array.org.w3c.dom.DOMExceptionprotected void insertChild(org.w3c.dom.Element e,
java.lang.String[] tag,
java.lang.String[] ns)
throws org.w3c.dom.DOMException
e - The child element to insert.tag - An array of element tag names after any occurrence of which the child element is to be inserted. The tags must be presented in the order in which they appear in the parent element's schema.ns - An array of namespace URIs corresponding to the tag names in the tag array.org.w3c.dom.DOMExceptionprotected void removeChildren(java.lang.String tag,
java.lang.String ns)
tag - The tag name of the child element(s) to remove.ns - The namespace URI of the element(s) to remove.