Class CanonicalizerPhysical
java.lang.Object
org.apache.xml.security.c14n.CanonicalizerSpi
org.apache.xml.security.c14n.implementations.CanonicalizerBase
org.apache.xml.security.c14n.implementations.CanonicalizerPhysical
Serializes the physical representation of the subtree. All the attributes
present in the subtree are emitted. The attributes are sorted within an element,
with the namespace declarations appearing before the regular attributes.
This algorithm is not a true canonicalization since equivalent subtrees
may produce different output. It is therefore unsuitable for digital signatures.
This same property makes it ideal for XML Encryption Syntax and Processing,
because the decrypted XML content will share the same physical representation
as the original XML content that was encrypted.
-
Field Summary
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
byte[]
engineCanonicalizeSubTree
(Node rootNode, String inclusiveNamespaces) Always throws a CanonicalizationException.byte[]
engineCanonicalizeSubTree
(Node rootNode, String inclusiveNamespaces, boolean propagateDefaultNamespace) Always throws a CanonicalizationException.byte[]
engineCanonicalizeXPathNodeSet
(Set<Node> xpathNodeSet, String inclusiveNamespaces) Always throws a CanonicalizationException.final boolean
Returns true if comments are includedfinal String
Returns the URI of this engine.protected void
protected void
outputAttributes
(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache) protected void
outputAttributesSubtree
(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache) Output the Attr[]s for the given element.protected void
outputCommentToWriter
(Comment currentComment, OutputStream writer, int position) Method outputCommentToWriterprotected void
outputPItoWriter
(ProcessingInstruction currentPI, OutputStream writer, int position) Outputs a PI to the internal Writer.Methods inherited from class org.apache.xml.security.c14n.implementations.CanonicalizerBase
canonicalizeSubTree, canonicalizeXPathNodeSet, engineCanonicalize, engineCanonicalizeSubTree, engineCanonicalizeSubTree, engineCanonicalizeXPathNodeSet, getNullNode, getParentNameSpaces, getWriter, isVisible, isVisibleDO, isVisibleInt, outputAttrToWriter, outputTextToWriter, setWriter
Methods inherited from class org.apache.xml.security.c14n.CanonicalizerSpi
engineCanonicalize, engineCanonicalizeXPathNodeSet, engineCanonicalizeXPathNodeSet, isSecureValidation, setSecureValidation
-
Constructor Details
-
CanonicalizerPhysical
public CanonicalizerPhysical()Constructor Canonicalizer20010315
-
-
Method Details
-
engineCanonicalizeXPathNodeSet
public byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces) throws CanonicalizationException Always throws a CanonicalizationException.- 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.- 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.- 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.- Parameters:
element
-ns
-cache
-- Throws:
CanonicalizationException
DOMException
IOException
-
outputAttributes
protected void outputAttributes(Element element, NameSpaceSymbTable ns, Map<String, byte[]> cache) throws CanonicalizationException, DOMException, IOException -
circumventBugIfNeeded
protected void circumventBugIfNeeded(XMLSignatureInput input) throws CanonicalizationException, ParserConfigurationException, IOException, SAXException -
handleParent
- Overrides:
handleParent
in classCanonicalizerBase
-
engineGetURI
Returns the URI of this engine.- Specified by:
engineGetURI
in classCanonicalizerSpi
- Returns:
- the URI
-
engineGetIncludeComments
public final boolean engineGetIncludeComments()Returns true if comments are included- Specified by:
engineGetIncludeComments
in classCanonicalizerSpi
- Returns:
- true if comments are included
-
outputPItoWriter
protected void outputPItoWriter(ProcessingInstruction currentPI, OutputStream writer, int position) throws IOException Description copied from class:CanonicalizerBase
Outputs a PI to the internal Writer.- Overrides:
outputPItoWriter
in classCanonicalizerBase
writer
- where to write the things- Throws:
IOException
-
outputCommentToWriter
protected void outputCommentToWriter(Comment currentComment, OutputStream writer, int position) throws IOException Description copied from class:CanonicalizerBase
Method outputCommentToWriter- Overrides:
outputCommentToWriter
in classCanonicalizerBase
writer
- writer where to write the things- Throws:
IOException
-