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.c14n
Class C14NImpl

java.lang.Object
  extended by oracle.security.xmlsec.c14n.C14NImpl


public class C14NImpl
extends java.lang.Object

Internal use only. Class implementing XML-C14N (RFC 3076 Canonical XML Version 1.0) and Exclusive XML-C14N, with and without comments processing.


Nested Class Summary
protected static class C14NImpl.AttrComparator
          Internal use only.
protected static class C14NImpl.NSComparator
          Internal use only.
protected static class C14NImpl.NSPrefixComparator
          Internal use only.

 

Field Summary
protected  java.lang.StringBuffer output
          The output buffer in which the generated canonical representation is stored.

 

Constructor Summary
protected C14NImpl()
          Creates a C14NImpl object with comments parsing and exclusive canonicalization turned off.
protected C14NImpl(boolean withComments)
          Creates a C14NImpl object with exclusive canonicalization turned off.
protected C14NImpl(boolean withComments, boolean exclusiveMode)
          Creates a C14NImpl object.

 

Method Summary
protected  byte[] canonicalize(java.util.Collection source)
          Returns the canonical octets for the given input node-set.
protected  byte[] canonicalize(org.xml.sax.InputSource source)
          Parses the XML in the given InputSource and returns the canonical octets.
protected  byte[] canonicalize(java.io.InputStream source)
          Parses the XML in the given input stream and returns the canonical octets.
protected  byte[] canonicalize(java.io.InputStream source, java.lang.String systemId)
          Parses the XML in the given input stream and returns the canonical octets.
protected  byte[] canonicalize(org.w3c.dom.Node source)
          Returns the canonical octets for the document sub-tree rooted in the given node.
protected  byte[] canonicalize(org.w3c.dom.NodeList source)
          Returns the canonical octets for the given input node-set.
protected static java.util.SortedMap getAncestorXMLAttrs(org.w3c.dom.Element element)
          Returns a table of attributes in the XML namespace (e.g., xml:space="preserve") that should be inherited by the given element if its parent node is not in the input node-set.
protected static boolean isEmptyDefaultNS(org.jaxen.dom.NamespaceNode nsNode)
          Returns true if the given namespace node is the empty default namespace, xmlns=""; otherwise returns false.
static boolean isRelativeNS(java.lang.String nsURI)
           
protected static boolean isXMLNamespaceDecl(org.jaxen.dom.NamespaceNode nsNode)
          Returns true if the given namespace node is the XML namespace, xmlns:xml="http://www.w3.org/XML/1998/namespace"; otherwise returns false.
protected  void processAttribute(org.w3c.dom.Attr attr)
          Processes org.w3c.dom.Attribute nodes, and stores the result in the output buffer.
protected  void processChildAxis(org.w3c.dom.Node node, java.util.SortedMap inScopeNamespaces, java.util.SortedMap xmlAttributes)
          Processes child axis of the given node and stores the result in the output buffer.
protected  void processComment(org.w3c.dom.Comment comment)
          Processes org.w3c.dom.Comment nodes, and stores the result in the output buffer.
protected  void processDocument(org.w3c.dom.Document doc)
          Processes org.w3c.dom.Document nodes (which consists of processing the node's child axis) and stores the result in the output buffer.
protected  void processElement(org.w3c.dom.Element element, java.util.SortedMap inScopeNamespaces, java.util.SortedMap xmlAttributes)
          Processes org.w3c.dom.Element nodes, (which consists of processing its namespace, attribute and child axes) and stores the result in the output buffer.
protected  void processNamespace(org.jaxen.dom.NamespaceNode ns)
          Processes org.w3c.dom.Namespace nodes, and stores the result in the output buffer.
protected  void processNode(org.w3c.dom.Node node, java.util.SortedMap inScopeNamespaces, java.util.SortedMap xmlAttributes)
          Generates the canonical representation of the given input node, and stores it in the output buffer.
protected  void processNodeSet(java.util.Set nodeset)
          Generates the canonical representation of the given input node-set, and stores it in the output buffer.
protected  void processNonXPathNode(org.w3c.dom.Node node)
          Processes any instance of org.w3c.dom.Node that is not represented in the XPath 1.0 data mode; outputs nothing.
protected  void processPI(org.w3c.dom.ProcessingInstruction pi)
          Processes org.w3c.dom.ProcessingInstruction nodes, and stores the result in the output buffer.
protected  void processText(org.w3c.dom.Text text)
          Processes org.w3c.dom.Text nodes, and stores the result in the output buffer.
protected  void setInclusiveNamespacePrefixList(java.lang.String list)
          For Exclusive C14N only: Sets the namespace prefixes that will not be treated as exclusive.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

output

protected java.lang.StringBuffer output
The output buffer in which the generated canonical representation is stored. To obtain the canonical octets, invoke oracle.security.crypto.util.Utils.toUTF8(output.toString()).

Constructor Detail

C14NImpl

protected C14NImpl()
Creates a C14NImpl object with comments parsing and exclusive canonicalization turned off.

C14NImpl

protected C14NImpl(boolean withComments)
Creates a C14NImpl object with exclusive canonicalization turned off.
Parameters:
withComments - If true, comments will be included.

C14NImpl

protected C14NImpl(boolean withComments,
                   boolean exclusiveMode)
Creates a C14NImpl object.
Parameters:
withComments - If true, comments will be included.
exclusiveMode - If true, exclusive canonicalization will be performed.

Method Detail

setInclusiveNamespacePrefixList

protected void setInclusiveNamespacePrefixList(java.lang.String list)
For Exclusive C14N only: Sets the namespace prefixes that will not be treated as exclusive. Also sets this C14NImpl to Exclusive C14N.
Parameters:
list - A whitespace-separated list of prefixes.

canonicalize

protected byte[] canonicalize(java.io.InputStream source)
                       throws CanonicalizationException
Parses the XML in the given input stream and returns the canonical octets.
Throws:
CanonicalizationException

canonicalize

protected byte[] canonicalize(java.io.InputStream source,
                              java.lang.String systemId)
                       throws CanonicalizationException
Parses the XML in the given input stream and returns the canonical octets.
Throws:
CanonicalizationException

canonicalize

protected byte[] canonicalize(org.xml.sax.InputSource source)
                       throws CanonicalizationException
Parses the XML in the given InputSource and returns the canonical octets.
Throws:
CanonicalizationException

canonicalize

protected byte[] canonicalize(org.w3c.dom.NodeList source)
                       throws CanonicalizationException
Returns the canonical octets for the given input node-set.
Throws:
CanonicalizationException

canonicalize

protected byte[] canonicalize(java.util.Collection source)
                       throws CanonicalizationException
Returns the canonical octets for the given input node-set.
Throws:
CanonicalizationException

canonicalize

protected byte[] canonicalize(org.w3c.dom.Node source)
                       throws CanonicalizationException
Returns the canonical octets for the document sub-tree rooted in the given node.
Throws:
CanonicalizationException

processNodeSet

protected void processNodeSet(java.util.Set nodeset)
                       throws CanonicalizationException
Generates the canonical representation of the given input node-set, and stores it in the output buffer.
Throws:
CanonicalizationException

processNode

protected void processNode(org.w3c.dom.Node node,
                           java.util.SortedMap inScopeNamespaces,
                           java.util.SortedMap xmlAttributes)
                    throws CanonicalizationException
Generates the canonical representation of the given input node, and stores it in the output buffer.
Parameters:
node - The node to be processed. If node is an element, it's namespace, attribute and child axes will also be processed.
inScopeNamespaces - A table of namespace nodes that are in scope for the given node. The SortedMap must use an instance of C14NImpl.NSComparator, and the contained namespace nodes serve as both keys and values.
xmlAttributes - A table of attribute nodes in the XML namespace (e.g., xml:space="preserve"), that should be inherited by the given node if its parent is not in the input node-set. The keys in the table consist of the attribute names and the values are the attribute nodes. See getAncestorXMLAttrs(org.w3c.dom.Element).
Throws:
CanonicalizationException
See Also:
processAttribute(org.w3c.dom.Attr), processComment(org.w3c.dom.Comment), processDocument(org.w3c.dom.Document), processElement(org.w3c.dom.Element, java.util.SortedMap, java.util.SortedMap), processNamespace(org.jaxen.dom.NamespaceNode), processNonXPathNode(org.w3c.dom.Node), processPI(org.w3c.dom.ProcessingInstruction), processText(org.w3c.dom.Text)

processNonXPathNode

protected void processNonXPathNode(org.w3c.dom.Node node)
Processes any instance of org.w3c.dom.Node that is not represented in the XPath 1.0 data mode; outputs nothing.

processDocument

protected void processDocument(org.w3c.dom.Document doc)
                        throws CanonicalizationException
Processes org.w3c.dom.Document nodes (which consists of processing the node's child axis) and stores the result in the output buffer.
Throws:
CanonicalizationException
See Also:
processChildAxis(org.w3c.dom.Node, java.util.SortedMap, java.util.SortedMap)

processPI

protected void processPI(org.w3c.dom.ProcessingInstruction pi)
Processes org.w3c.dom.ProcessingInstruction nodes, and stores the result in the output buffer.

processComment

protected void processComment(org.w3c.dom.Comment comment)
Processes org.w3c.dom.Comment nodes, and stores the result in the output buffer.

processText

protected void processText(org.w3c.dom.Text text)
Processes org.w3c.dom.Text nodes, and stores the result in the output buffer.

processAttribute

protected void processAttribute(org.w3c.dom.Attr attr)
Processes org.w3c.dom.Attribute nodes, and stores the result in the output buffer.

processNamespace

protected void processNamespace(org.jaxen.dom.NamespaceNode ns)
                         throws CanonicalizationException
Processes org.w3c.dom.Namespace nodes, and stores the result in the output buffer.
Throws:
CanonicalizationException

processElement

protected void processElement(org.w3c.dom.Element element,
                              java.util.SortedMap inScopeNamespaces,
                              java.util.SortedMap xmlAttributes)
                       throws CanonicalizationException
Processes org.w3c.dom.Element nodes, (which consists of processing its namespace, attribute and child axes) and stores the result in the output buffer.
Parameters:
element - The element node to be processed.
inScopeNamespaces - A table of namespace nodes that are in scope for the given element. The SortedMap must use an instance of C14NImpl.NSComparator, and the contained namespace nodes serve as both keys and values.
xmlAttributes - A table of attribute nodes in the XML namespace (e.g., xml:space="preserve"), that should be inherited by the given element if its parent is not in the input node-set. The keys in the table consist of the attribute names and the values are the attribute nodes. See getAncestorXMLAttrs(org.w3c.dom.Element).
Throws:
CanonicalizationException
See Also:
processChildAxis(org.w3c.dom.Node, java.util.SortedMap, java.util.SortedMap)

processChildAxis

protected void processChildAxis(org.w3c.dom.Node node,
                                java.util.SortedMap inScopeNamespaces,
                                java.util.SortedMap xmlAttributes)
                         throws CanonicalizationException
Processes child axis of the given node and stores the result in the output buffer.
Parameters:
node - The node whose children are to be processed.
inScopeNamespaces - A table of namespace nodes that are in scope for the given node. The SortedMap must use an instance of C14NImpl.NSComparator, and the contained namespace nodes serve as both keys and values.
xmlAttributes - A table of attribute nodes in the XML namespace (e.g., xml:space="preserve"), that should be inherited by the given node if its parent is not in the input node-set. The keys in the table consist of the attribute names and the values are the attribute nodes. See getAncestorXMLAttrs(org.w3c.dom.Element).
Throws:
CanonicalizationException

isEmptyDefaultNS

protected static boolean isEmptyDefaultNS(org.jaxen.dom.NamespaceNode nsNode)
Returns true if the given namespace node is the empty default namespace, xmlns=""; otherwise returns false.

isXMLNamespaceDecl

protected static boolean isXMLNamespaceDecl(org.jaxen.dom.NamespaceNode nsNode)
Returns true if the given namespace node is the XML namespace, xmlns:xml="http://www.w3.org/XML/1998/namespace"; otherwise returns false.

isRelativeNS

public static boolean isRelativeNS(java.lang.String nsURI)

getAncestorXMLAttrs

protected static java.util.SortedMap getAncestorXMLAttrs(org.w3c.dom.Element element)
Returns a table of attributes in the XML namespace (e.g., xml:space="preserve") that should be inherited by the given element if its parent node is not in the input node-set.

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.