APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.security.c14n.implementations

public abstract Class CanonicalizerBase

extends CanonicalizerSpi
Class Inheritance
Known Direct Subclasses
com.sun.org.apache.xml.internal.security.c14n.implementations.CanonicalizerPhysical, com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315, com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315Excl
Imports
java.io.IOException, .OutputStream, .UnsupportedEncodingException, java.util.ArrayList, .HashMap, .List, .ListIterator, .Map, .Set, com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException, .CanonicalizerSpi, com.sun.org.apache.xml.internal.security.c14n.helper.AttrCompare, com.sun.org.apache.xml.internal.security.parser.XMLParserException, com.sun.org.apache.xml.internal.security.signature.NodeFilter, .XMLSignatureInput, com.sun.org.apache.xml.internal.security.utils.Constants, .XMLUtils, org.w3c.dom.Attr, .Comment, .DOMException, .Document, .Element, .NamedNodeMap, .Node, .ProcessingInstruction

Abstract base class for canonicalization algorithms. Please note that these implementations are NOT thread safe - please see the following JIRA for more information: https://issues.apache.org/jira/browse/SANTUARIO-463

Field Summary

Modifier and TypeField and Description
private static final byte[]
private static final byte[]
private static final byte[]
protected static final AttrCompare
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private boolean
private static final byte[]
protected static final int
protected static final int
protected static final int
private List<NodeFilter>
private Attr
nullNode

The null xmlns definition.

private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
public static final String
public static final String
public static final String
public static final String
private Set<Node>

Constructor Summary

AccessConstructor and Description
protected
CanonicalizerBase(boolean includeComments)

Constructor CanonicalizerBase

Method Summary

Modifier and TypeMethod and Description
private void
canonicalizeSubTree(Node currentNode, NameSpaceSymbTable ns, Node endnode, int documentLevel, Node excludeNode, OutputStream
OutputStream to write the canonicalization result
writer
)

Method canonicalizeSubTree, this function is a recursive one.

private void
canonicalizeXPathNodeSet(Node currentNode, Node endnode, OutputStream
OutputStream to write the canonicalization result
writer
)

Canonicalizes all the nodes included in the currentNode and contained in the xpathNodeSet field.

pack-priv abstract void
public void
engineCanonicalize(XMLSignatureInput
the root of the subtree to canicalize
input
,
OutputStream
OutputStream to write the canonicalization result
writer
,
boolean
Whether secure validation is enabled
secureValidation
)

Canonicalizes a Subtree node.

public void
engineCanonicalizeSubTree(Node rootNode, OutputStream
OutputStream to write the canonicalization result
writer
)

Implements abstract com.sun.org.apache.xml.internal.security.c14n.CanonicalizerSpi.engineCanonicalizeSubTree.

Method engineCanonicalizeSubTree C14n a node tree.

protected void
engineCanonicalizeSubTree(Node
the root of the subtree to canonicalize
rootNode
,
Node
a node to be excluded from the canonicalize operation
excludeNode
,
OutputStream
OutputStream to write the canonicalization result
writer
)

Canonicalizes a Subtree node.

public void
engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, OutputStream
OutputStream to write the canonicalization result
writer
)

Implements abstract com.sun.org.apache.xml.internal.security.c14n.CanonicalizerSpi.engineCanonicalizeXPathNodeSet.

Method engineCanonicalizeXPathNodeSet C14n a nodeset

private void
protected Attr
getNullNode(Document ownerDocument)

private void
getParentNameSpaces(Element el, NameSpaceSymbTable ns)

Adds to ns the definitions from the parent elements of el

protected void
protected boolean
isVisible(Node currentNode)

protected int
isVisibleDO(Node currentNode, int level)

protected int
isVisibleInt(Node currentNode)

pack-priv abstract void
outputAttributes(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache, OutputStream
OutputStream to write the canonicalization result
writer
)

Output the attributes for this node in XPathNodeSet c14n.

pack-priv abstract void
outputAttributesSubtree(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache, OutputStream
OutputStream to write the canonicalization result
writer
)

Output the attributes for this node in a Subtree c14n.

protected static final void
outputAttrToWriter(final String name, final String value, final OutputStream writer, final Map<String, byte[]> cache)

Outputs an Attribute to the internal Writer.

protected void
outputCommentToWriter(Comment currentComment, OutputStream
writer where to write the things
writer
,
int position)

Method outputCommentToWriter

protected void
outputPItoWriter(ProcessingInstruction currentPI, OutputStream
where to write the things
writer
,
int position)

Outputs a PI to the internal Writer.

private static final void
outputTextToWriter(final String text, final OutputStream
writer where to write the things
writer
)

Outputs a Text of CDATA section to the internal Writer.

Inherited from com.sun.org.apache.xml.internal.security.c14n.CanonicalizerSpi:
engineCanonicalizeengineCanonicalizeSubTreeengineCanonicalizeSubTreeengineCanonicalizeXPathNodeSetengineGetURI

Field Detail

AMPback to summary
private static final byte[] AMP
BEGIN_COMMback to summary
private static final byte[] BEGIN_COMM
BEGIN_PIback to summary
private static final byte[] BEGIN_PI
COMPAREback to summary
protected static final AttrCompare COMPARE
END_COMMback to summary
private static final byte[] END_COMM
END_PIback to summary
private static final byte[] END_PI
END_TAGback to summary
private static final byte[] END_TAG
EQUALS_STRback to summary
private static final byte[] EQUALS_STR
GTback to summary
private static final byte[] GT
includeCommentsback to summary
private boolean includeComments
LTback to summary
private static final byte[] LT
NODE_AFTER_DOCUMENT_ELEMENTback to summary
protected static final int NODE_AFTER_DOCUMENT_ELEMENT
NODE_BEFORE_DOCUMENT_ELEMENTback to summary
protected static final int NODE_BEFORE_DOCUMENT_ELEMENT
NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENTback to summary
protected static final int NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT
nodeFilterback to summary
private List<NodeFilter> nodeFilter
nullNodeback to summary
private Attr nullNode

The null xmlns definition.

QUOTback to summary
private static final byte[] QUOT
X9back to summary
private static final byte[] X9
XAback to summary
private static final byte[] XA
XDback to summary
private static final byte[] XD
XMLback to summary
public static final String XML
XML_LANG_URIback to summary
public static final String XML_LANG_URI
XMLNSback to summary
public static final String XMLNS
XMLNS_URIback to summary
public static final String XMLNS_URI
xpathNodeSetback to summary
private Set<Node> xpathNodeSet

Constructor Detail

CanonicalizerBaseback to summary
protected CanonicalizerBase(boolean includeComments)

Constructor CanonicalizerBase

Method Detail

canonicalizeSubTreeback to summary
private void canonicalizeSubTree(Node currentNode, NameSpaceSymbTable ns, Node endnode, int documentLevel, Node excludeNode, OutputStream writer) throws CanonicalizationException, IOException

Method canonicalizeSubTree, this function is a recursive one.

Parameters
writer:OutputStream

OutputStream to write the canonicalization result

canonicalizeXPathNodeSetback to summary
private void canonicalizeXPathNodeSet(Node currentNode, Node endnode, OutputStream writer) throws CanonicalizationException, IOException

Canonicalizes all the nodes included in the currentNode and contained in the xpathNodeSet field.

Parameters
writer:OutputStream

OutputStream to write the canonicalization result

circumventBugIfNeededback to summary
pack-priv abstract void circumventBugIfNeeded(XMLSignatureInput input) throws XMLParserException, IOException
engineCanonicalizeback to summary
public void engineCanonicalize(XMLSignatureInput input, OutputStream writer, boolean secureValidation) throws CanonicalizationException

Canonicalizes a Subtree node.

Parameters
input:XMLSignatureInput

the root of the subtree to canicalize

writer:OutputStream

OutputStream to write the canonicalization result

secureValidation:boolean

Whether secure validation is enabled

engineCanonicalizeSubTreeback to summary
public void engineCanonicalizeSubTree(Node rootNode, OutputStream writer) throws CanonicalizationException

Implements abstract com.sun.org.apache.xml.internal.security.c14n.CanonicalizerSpi.engineCanonicalizeSubTree.

Doc from com.sun.org.apache.xml.internal.security.c14n.CanonicalizerSpi.engineCanonicalizeSubTree.

Method engineCanonicalizeSubTree C14n a node tree.

Parameters
writer:OutputStream

OutputStream to write the canonicalization result

Annotations
@Override
engineCanonicalizeSubTreeback to summary
protected void engineCanonicalizeSubTree(Node rootNode, Node excludeNode, OutputStream writer) throws CanonicalizationException

Canonicalizes a Subtree node.

Parameters
rootNode:Node

the root of the subtree to canonicalize

excludeNode:Node

a node to be excluded from the canonicalize operation

writer:OutputStream

OutputStream to write the canonicalization result

engineCanonicalizeXPathNodeSetback to summary
public void engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, OutputStream writer) throws CanonicalizationException

Implements abstract com.sun.org.apache.xml.internal.security.c14n.CanonicalizerSpi.engineCanonicalizeXPathNodeSet.

Doc from com.sun.org.apache.xml.internal.security.c14n.CanonicalizerSpi.engineCanonicalizeXPathNodeSet.

Method engineCanonicalizeXPathNodeSet C14n a nodeset

Parameters
writer:OutputStream

OutputStream to write the canonicalization result

Annotations
@Override
engineCanonicalizeXPathNodeSetInternalback to summary
private void engineCanonicalizeXPathNodeSetInternal(Node doc, OutputStream writer) throws CanonicalizationException
getNullNodeback to summary
protected Attr getNullNode(Document ownerDocument)
getParentNameSpacesback to summary
private void getParentNameSpaces(Element el, NameSpaceSymbTable ns)

Adds to ns the definitions from the parent elements of el

handleParentback to summary
protected void handleParent(Element e, NameSpaceSymbTable ns)
isVisibleback to summary
protected boolean isVisible(Node currentNode) throws CanonicalizationException
isVisibleDOback to summary
protected int isVisibleDO(Node currentNode, int level) throws CanonicalizationException
isVisibleIntback to summary
protected int isVisibleInt(Node currentNode) throws CanonicalizationException
outputAttributesback to summary
pack-priv abstract void outputAttributes(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache, OutputStream writer) throws CanonicalizationException, DOMException, IOException

Output the attributes for this node in XPathNodeSet c14n.

Parameters
writer:OutputStream

OutputStream to write the canonicalization result

outputAttributesSubtreeback to summary
pack-priv abstract void outputAttributesSubtree(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache, OutputStream writer) throws CanonicalizationException, DOMException, IOException

Output the attributes for this node in a Subtree c14n.

Parameters
writer:OutputStream

OutputStream to write the canonicalization result

outputAttrToWriterback to summary
protected static final void outputAttrToWriter(final String name, final String value, final OutputStream writer, final Map<String, byte[]> cache) throws IOException

Outputs an Attribute to the internal Writer. The string value of the node is modified by replacing

  • all ampersands with &
  • all open angle brackets with <
  • all quotation mark characters with "
  • and the whitespace characters #x9, #xA, and #xD, with character references. The character references are written in uppercase hexadecimal with no leading zeroes (for example, #xD is represented by the character reference )
outputCommentToWriterback to summary
protected void outputCommentToWriter(Comment currentComment, OutputStream writer, int position) throws IOException

Method outputCommentToWriter

Parameters
writer:OutputStream

writer where to write the things

outputPItoWriterback to summary
protected void outputPItoWriter(ProcessingInstruction currentPI, OutputStream writer, int position) throws IOException

Outputs a PI to the internal Writer.

Parameters
writer:OutputStream

where to write the things

outputTextToWriterback to summary
private static final void outputTextToWriter(final String text, final OutputStream writer) throws IOException

Outputs a Text of CDATA section to the internal Writer.

Parameters
writer:OutputStream

writer where to write the things