Class Canonicalizer20010315
java.lang.Object
org.apache.xml.security.c14n.CanonicalizerSpi
org.apache.xml.security.c14n.implementations.CanonicalizerBase
org.apache.xml.security.c14n.implementations.Canonicalizer20010315
- Direct Known Subclasses:
Canonicalizer11_OmitComments
,Canonicalizer11_WithComments
,Canonicalizer20010315OmitComments
,Canonicalizer20010315WithComments
Implements Canonical
XML Version 1.0, a W3C Recommendation from 15 March 2001.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
private boolean
private final XmlAttrStack
Fields inherited from class org.apache.xml.security.c14n.implementations.CanonicalizerBase
COMPARE, NODE_AFTER_DOCUMENT_ELEMENT, NODE_BEFORE_DOCUMENT_ELEMENT, NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT, XML, XML_LANG_URI, XMLNS, XMLNS_URI
Fields inherited from class org.apache.xml.security.c14n.CanonicalizerSpi
reset, secureValidation
-
Constructor Summary
ConstructorsConstructorDescriptionCanonicalizer20010315
(boolean includeComments) Constructor Canonicalizer20010315Canonicalizer20010315
(boolean includeComments, boolean c14n11) Constructor Canonicalizer20010315 -
Method Summary
Modifier and TypeMethodDescriptionprotected void
byte[]
engineCanonicalizeSubTree
(Node rootNode, String inclusiveNamespaces) Always throws a CanonicalizationException because this is inclusive c14n.byte[]
engineCanonicalizeSubTree
(Node rootNode, String inclusiveNamespaces, boolean propagateDefaultNamespace) Always throws a CanonicalizationException because this is inclusive c14n.byte[]
engineCanonicalizeXPathNodeSet
(Set<Node> xpathNodeSet, String inclusiveNamespaces) Always throws a CanonicalizationException because this is inclusive c14n.protected void
protected void
outputAttributes
(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache) Output the Attr[]s for the given element.protected void
outputAttributesSubtree
(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache) Output the Attr[]s for the given element.Methods inherited from class org.apache.xml.security.c14n.implementations.CanonicalizerBase
canonicalizeSubTree, canonicalizeXPathNodeSet, engineCanonicalize, engineCanonicalizeSubTree, engineCanonicalizeSubTree, engineCanonicalizeXPathNodeSet, getNullNode, getParentNameSpaces, getWriter, isVisible, isVisibleDO, isVisibleInt, outputAttrToWriter, outputCommentToWriter, outputPItoWriter, outputTextToWriter, setWriter
Methods inherited from class org.apache.xml.security.c14n.CanonicalizerSpi
engineCanonicalize, engineCanonicalizeXPathNodeSet, engineCanonicalizeXPathNodeSet, engineGetIncludeComments, engineGetURI, isSecureValidation, setSecureValidation
-
Field Details
-
firstCall
private boolean firstCall -
xmlattrStack
-
c14n11
private final boolean c14n11
-
-
Constructor Details
-
Canonicalizer20010315
public Canonicalizer20010315(boolean includeComments) Constructor Canonicalizer20010315- Parameters:
includeComments
-
-
Canonicalizer20010315
public Canonicalizer20010315(boolean includeComments, boolean c14n11) Constructor Canonicalizer20010315- Parameters:
includeComments
-c14n11
- Whether this is a Canonical XML 1.1 implementation or not
-
-
Method Details
-
engineCanonicalizeXPathNodeSet
public byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces) throws CanonicalizationException Always throws a CanonicalizationException because this is inclusive c14n.- Specified by:
engineCanonicalizeXPathNodeSet
in classCanonicalizerSpi
- Parameters:
xpathNodeSet
-inclusiveNamespaces
-- Returns:
- none it always fails
- Throws:
CanonicalizationException
- always
-
engineCanonicalizeSubTree
public byte[] engineCanonicalizeSubTree(Node rootNode, String inclusiveNamespaces) throws CanonicalizationException Always throws a CanonicalizationException because this is inclusive c14n.- Specified by:
engineCanonicalizeSubTree
in classCanonicalizerSpi
- Parameters:
rootNode
-inclusiveNamespaces
-- Returns:
- none it always fails
- Throws:
CanonicalizationException
-
engineCanonicalizeSubTree
public byte[] engineCanonicalizeSubTree(Node rootNode, String inclusiveNamespaces, boolean propagateDefaultNamespace) throws CanonicalizationException Always throws a CanonicalizationException because this is inclusive c14n.- Specified by:
engineCanonicalizeSubTree
in classCanonicalizerSpi
- Parameters:
rootNode
-inclusiveNamespaces
-propagateDefaultNamespace
- If true the default namespace will be propagated to the c14n-ized root element- Returns:
- none it always fails
- Throws:
CanonicalizationException
-
outputAttributesSubtree
protected void outputAttributesSubtree(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache) throws CanonicalizationException, DOMException, IOExceptionOutput the Attr[]s for the given element.
The code of this method is a copy ofoutputAttributes(Element, NameSpaceSymbTable, Map)
, whereas it takes into account that subtree-c14n is -- well -- subtree-based. So if the element in question isRoot of c14n, it's parent is not in the node set, as well as all other ancestors.- Specified by:
outputAttributesSubtree
in classCanonicalizerBase
- Parameters:
element
-ns
-cache
-- Throws:
CanonicalizationException
DOMException
IOException
-
outputAttributes
protected void outputAttributes(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache) throws CanonicalizationException, DOMException, IOExceptionOutput the Attr[]s for the given element.
IMPORTANT: This method expects to work on a modified DOM tree, i.e. a DOM which has been prepared usingXMLUtils.circumventBug2650(org.w3c.dom.Document)
.- Specified by:
outputAttributes
in classCanonicalizerBase
- Parameters:
element
-ns
-cache
-- Throws:
CanonicalizationException
DOMException
IOException
-
circumventBugIfNeeded
protected void circumventBugIfNeeded(XMLSignatureInput input) throws CanonicalizationException, ParserConfigurationException, IOException, SAXException - Specified by:
circumventBugIfNeeded
in classCanonicalizerBase
- Throws:
CanonicalizationException
ParserConfigurationException
IOException
SAXException
-
handleParent
- Overrides:
handleParent
in classCanonicalizerBase
-