Module org.apache.santuario.xmlsec
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
-
public class CanonicalizerPhysical extends CanonicalizerBase
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
-
-
Constructor Summary
Constructors Constructor Description CanonicalizerPhysical()Constructor Canonicalizer20010315
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcircumventBugIfNeeded(XMLSignatureInput input)voidengineCanonicalizeSubTree(Node rootNode, String inclusiveNamespaces, boolean propagateDefaultNamespace, OutputStream writer)Always throws a CanonicalizationException.voidengineCanonicalizeSubTree(Node rootNode, String inclusiveNamespaces, OutputStream writer)Always throws a CanonicalizationException.voidengineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces, OutputStream writer)Always throws a CanonicalizationException.StringengineGetURI()Returns the URI of this engine.protected voidhandleParent(Element e, NameSpaceSymbTable ns)protected voidoutputAttributes(Element element, NameSpaceSymbTable ns, Map<String,byte[]> cache, OutputStream writer)protected voidoutputAttributesSubtree(Element element, NameSpaceSymbTable ns, Map<String,byte[]> cache, OutputStream writer)Output the Attr[]s for the given element.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.implementations.CanonicalizerBase
engineCanonicalize, engineCanonicalizeSubTree, engineCanonicalizeSubTree, engineCanonicalizeXPathNodeSet, getNullNode, isVisible, isVisibleDO, isVisibleInt, outputAttrToWriter
-
Methods inherited from class org.apache.xml.security.c14n.CanonicalizerSpi
engineCanonicalize
-
-
-
-
Method Detail
-
engineCanonicalizeXPathNodeSet
public void engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces, OutputStream writer) throws CanonicalizationException
Always throws a CanonicalizationException.- Specified by:
engineCanonicalizeXPathNodeSetin classCanonicalizerSpi- Parameters:
xpathNodeSet-inclusiveNamespaces-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException- always
-
engineCanonicalizeSubTree
public void engineCanonicalizeSubTree(Node rootNode, String inclusiveNamespaces, OutputStream writer) throws CanonicalizationException
Always throws a CanonicalizationException.- Specified by:
engineCanonicalizeSubTreein classCanonicalizerSpi- Parameters:
rootNode-inclusiveNamespaces-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
engineCanonicalizeSubTree
public void engineCanonicalizeSubTree(Node rootNode, String inclusiveNamespaces, boolean propagateDefaultNamespace, OutputStream writer) throws CanonicalizationException
Always throws a CanonicalizationException.- Specified by:
engineCanonicalizeSubTreein classCanonicalizerSpi- Parameters:
rootNode-inclusiveNamespaces-writer- OutputStream to write the canonicalization resultpropagateDefaultNamespace- If true the default namespace will be propagated to the c14n-ized root element- Throws:
CanonicalizationException
-
outputAttributesSubtree
protected void outputAttributesSubtree(Element element, NameSpaceSymbTable ns, Map<String,byte[]> cache, OutputStream writer) throws CanonicalizationException, DOMException, IOException
Output the Attr[]s for the given element.
The code of this method is a copy ofoutputAttributes(Element, NameSpaceSymbTable, Map, OutputStream), 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-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationExceptionDOMExceptionIOException
-
outputAttributes
protected void outputAttributes(Element element, NameSpaceSymbTable ns, Map<String,byte[]> cache, OutputStream writer) throws CanonicalizationException, DOMException, IOException
-
circumventBugIfNeeded
protected void circumventBugIfNeeded(XMLSignatureInput input) throws org.apache.xml.security.parser.XMLParserException, IOException
- Throws:
org.apache.xml.security.parser.XMLParserExceptionIOException
-
handleParent
protected void handleParent(Element e, NameSpaceSymbTable ns)
- Overrides:
handleParentin classCanonicalizerBase
-
engineGetURI
public final String engineGetURI()
Returns the URI of this engine.- Specified by:
engineGetURIin classCanonicalizerSpi- Returns:
- the URI
-
outputPItoWriter
protected void outputPItoWriter(ProcessingInstruction currentPI, OutputStream writer, int position) throws IOException
Description copied from class:CanonicalizerBaseOutputs a PI to the internal Writer.- Overrides:
outputPItoWriterin classCanonicalizerBasewriter- where to write the things- Throws:
IOException
-
outputCommentToWriter
protected void outputCommentToWriter(Comment currentComment, OutputStream writer, int position) throws IOException
Description copied from class:CanonicalizerBaseMethod outputCommentToWriter- Overrides:
outputCommentToWriterin classCanonicalizerBasewriter- writer where to write the things- Throws:
IOException
-
-