Module org.apache.santuario.xmlsec
Class CanonicalizerBase
- java.lang.Object
-
- org.apache.xml.security.c14n.CanonicalizerSpi
-
- org.apache.xml.security.c14n.implementations.CanonicalizerBase
-
- Direct Known Subclasses:
Canonicalizer20010315,Canonicalizer20010315Excl,CanonicalizerPhysical
public abstract class CanonicalizerBase extends CanonicalizerSpi
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
Fields Modifier and Type Field Description protected static AttrCompareCOMPAREprotected static intNODE_AFTER_DOCUMENT_ELEMENTprotected static intNODE_BEFORE_DOCUMENT_ELEMENTprotected static intNODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENTstatic StringXMLstatic StringXML_LANG_URIstatic StringXMLNSstatic StringXMLNS_URI
-
Constructor Summary
Constructors Modifier Constructor Description protectedCanonicalizerBase(boolean includeComments)Constructor CanonicalizerBase
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidengineCanonicalize(XMLSignatureInput input, OutputStream writer, boolean secureValidation)Canonicalizes a Subtree node.voidengineCanonicalizeSubTree(Node rootNode, OutputStream writer)Method engineCanonicalizeSubTree C14n a node tree.protected voidengineCanonicalizeSubTree(Node rootNode, Node excludeNode, OutputStream writer)Canonicalizes a Subtree node.voidengineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, OutputStream writer)Method engineCanonicalizeXPathNodeSet C14n a nodesetprotected AttrgetNullNode(Document ownerDocument)protected voidhandleParent(Element e, NameSpaceSymbTable ns)protected booleanisVisible(Node currentNode)protected intisVisibleDO(Node currentNode, int level)protected intisVisibleInt(Node currentNode)protected static voidoutputAttrToWriter(String name, String value, OutputStream writer, Map<String,byte[]> cache)Outputs an Attribute to the internal Writer.protected voidoutputCommentToWriter(Comment currentComment, OutputStream writer, int position)Method outputCommentToWriterprotected voidoutputPItoWriter(ProcessingInstruction currentPI, OutputStream writer, int position)Outputs a PI to the internal Writer.-
Methods inherited from class org.apache.xml.security.c14n.CanonicalizerSpi
engineCanonicalize, engineCanonicalizeSubTree, engineCanonicalizeSubTree, engineCanonicalizeXPathNodeSet, engineGetURI
-
-
-
-
Field Detail
-
XML
public static final String XML
- See Also:
- Constant Field Values
-
XMLNS
public static final String XMLNS
- See Also:
- Constant Field Values
-
XMLNS_URI
public static final String XMLNS_URI
- See Also:
- Constant Field Values
-
XML_LANG_URI
public static final String XML_LANG_URI
- See Also:
- Constant Field Values
-
COMPARE
protected static final AttrCompare COMPARE
-
NODE_BEFORE_DOCUMENT_ELEMENT
protected static final int NODE_BEFORE_DOCUMENT_ELEMENT
- See Also:
- Constant Field Values
-
NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT
protected static final int NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT
- See Also:
- Constant Field Values
-
NODE_AFTER_DOCUMENT_ELEMENT
protected static final int NODE_AFTER_DOCUMENT_ELEMENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
engineCanonicalizeSubTree
public void engineCanonicalizeSubTree(Node rootNode, OutputStream writer) throws CanonicalizationException
Method engineCanonicalizeSubTree C14n a node tree.- Specified by:
engineCanonicalizeSubTreein classCanonicalizerSpi- Parameters:
rootNode-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
engineCanonicalizeXPathNodeSet
public void engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, OutputStream writer) throws CanonicalizationException
Method engineCanonicalizeXPathNodeSet C14n a nodeset- Specified by:
engineCanonicalizeXPathNodeSetin classCanonicalizerSpi- Parameters:
xpathNodeSet-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
engineCanonicalize
public void engineCanonicalize(XMLSignatureInput input, OutputStream writer, boolean secureValidation) throws CanonicalizationException
Canonicalizes a Subtree node.- Parameters:
input- the root of the subtree to canicalizewriter- OutputStream to write the canonicalization resultsecureValidation- Whether secure validation is enabled- Throws:
CanonicalizationException
-
engineCanonicalizeSubTree
protected void engineCanonicalizeSubTree(Node rootNode, Node excludeNode, OutputStream writer) throws CanonicalizationException
Canonicalizes a Subtree node.- Parameters:
rootNode- the root of the subtree to canonicalizeexcludeNode- a node to be excluded from the canonicalize operationwriter- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
isVisibleDO
protected int isVisibleDO(Node currentNode, int level) throws CanonicalizationException
- Throws:
CanonicalizationException
-
isVisibleInt
protected int isVisibleInt(Node currentNode) throws CanonicalizationException
- Throws:
CanonicalizationException
-
isVisible
protected boolean isVisible(Node currentNode) throws CanonicalizationException
- Throws:
CanonicalizationException
-
handleParent
protected void handleParent(Element e, NameSpaceSymbTable ns)
-
outputAttrToWriter
protected static final void outputAttrToWriter(String name, String value, OutputStream writer, 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,#xDis represented by the character reference
)
- Parameters:
name-value-writer-- Throws:
IOException
- all ampersands with
-
outputPItoWriter
protected void outputPItoWriter(ProcessingInstruction currentPI, OutputStream writer, int position) throws IOException
Outputs a PI to the internal Writer.- Parameters:
currentPI-writer- where to write the things- Throws:
IOException
-
outputCommentToWriter
protected void outputCommentToWriter(Comment currentComment, OutputStream writer, int position) throws IOException
Method outputCommentToWriter- Parameters:
currentComment-writer- writer where to write the things- Throws:
IOException
-
-