org.apache.xml.security.c14n
Class Canonicalizer

java.lang.Object
  |
  +--org.apache.xml.security.c14n.Canonicalizer

public class Canonicalizer
extends java.lang.Object

Author:
Christian Geuer-Pollmann

Field Summary
static java.lang.String ALGO_ID_C14N_EXCL_OMIT_COMMENTS
           
static java.lang.String ALGO_ID_C14N_EXCL_WITH_COMMENTS
           
static java.lang.String ALGO_ID_C14N_OMIT_COMMENTS
           
static java.lang.String ALGO_ID_C14N_WITH_COMMENTS
           
protected  CanonicalizerSpi canonicalizerSpi
           
static java.lang.String ENCODING
          The output encoding of canonicalized data
static java.lang.String XPATH_C14N_OMIT_COMMENTS
           
static java.lang.String XPATH_C14N_OMIT_COMMENTS_SINGLE_NODE
           
static java.lang.String XPATH_C14N_WITH_COMMENTS
           
static java.lang.String XPATH_C14N_WITH_COMMENTS_SINGLE_NODE
           
 
Method Summary
 byte[] canonicalize(byte[] inputBytes)
          This method tries to canonicalize the given bytes.
 byte[] canonicalizeSubtree(org.w3c.dom.Node node)
          Canonicalizes the subtree rooted by node.
 byte[] canonicalizeSubtree(org.w3c.dom.Node node, java.lang.String inclusiveNamespaces)
          Canonicalizes the subtree rooted by node.
 byte[] canonicalizeXPathNodeSet(org.w3c.dom.NodeList xpathNodeSet)
          Canonicalizes an XPath node set.
 byte[] canonicalizeXPathNodeSet(org.w3c.dom.NodeList xpathNodeSet, java.lang.String inclusiveNamespaces)
          Canonicalizes an XPath node set.
 byte[] canonicalizeXPathNodeSet(java.util.Set xpathNodeSet)
          Canonicalizes an XPath node set.
 byte[] canonicalizeXPathNodeSet(java.util.Set xpathNodeSet, java.lang.String inclusiveNamespaces)
          Canonicalizes an XPath node set.
 java.lang.String getImplementingCanonicalizerClass()
          Returns the name of the implementing CanonicalizerSpi class
 boolean getIncludeComments()
          Method getIncludeComments
static Canonicalizer getInstance(java.lang.String algorithmURI)
          Method getInstance
 java.lang.String getURI()
          Method getURI
static void init()
          Method init
static void register(java.lang.String algorithmURI, java.lang.String implementingClass)
          Method register
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING

public static final java.lang.String ENCODING
The output encoding of canonicalized data

See Also:
Constant Field Values

XPATH_C14N_WITH_COMMENTS

public static final java.lang.String XPATH_C14N_WITH_COMMENTS
See Also:
Constant Field Values

XPATH_C14N_OMIT_COMMENTS

public static final java.lang.String XPATH_C14N_OMIT_COMMENTS
See Also:
Constant Field Values

XPATH_C14N_WITH_COMMENTS_SINGLE_NODE

public static final java.lang.String XPATH_C14N_WITH_COMMENTS_SINGLE_NODE
See Also:
Constant Field Values

XPATH_C14N_OMIT_COMMENTS_SINGLE_NODE

public static final java.lang.String XPATH_C14N_OMIT_COMMENTS_SINGLE_NODE
See Also:
Constant Field Values

ALGO_ID_C14N_OMIT_COMMENTS

public static final java.lang.String ALGO_ID_C14N_OMIT_COMMENTS
See Also:
Constant Field Values

ALGO_ID_C14N_WITH_COMMENTS

public static final java.lang.String ALGO_ID_C14N_WITH_COMMENTS
See Also:
Constant Field Values

ALGO_ID_C14N_EXCL_OMIT_COMMENTS

public static final java.lang.String ALGO_ID_C14N_EXCL_OMIT_COMMENTS
See Also:
Constant Field Values

ALGO_ID_C14N_EXCL_WITH_COMMENTS

public static final java.lang.String ALGO_ID_C14N_EXCL_WITH_COMMENTS
See Also:
Constant Field Values

canonicalizerSpi

protected CanonicalizerSpi canonicalizerSpi
Method Detail

init

public static void init()
Method init


getInstance

public static final Canonicalizer getInstance(java.lang.String algorithmURI)
                                       throws InvalidCanonicalizerException
Method getInstance

Parameters:
algorithmURI -
Throws:
InvalidCanonicalizerException

register

public static void register(java.lang.String algorithmURI,
                            java.lang.String implementingClass)
                     throws AlgorithmAlreadyRegisteredException
Method register

Parameters:
algorithmURI -
implementingClass -
Throws:
AlgorithmAlreadyRegisteredException

getURI

public final java.lang.String getURI()
Method getURI


getIncludeComments

public boolean getIncludeComments()
Method getIncludeComments


canonicalize

public byte[] canonicalize(byte[] inputBytes)
                    throws javax.xml.parsers.ParserConfigurationException,
                           java.io.IOException,
                           org.xml.sax.SAXException,
                           CanonicalizationException
This method tries to canonicalize the given bytes. It's possible to even canonicalize non-wellformed sequences if they are well-formed after being wrapped with a >a<...>/a<.

Parameters:
inputBytes -
Throws:
CanonicalizationException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException

canonicalizeSubtree

public byte[] canonicalizeSubtree(org.w3c.dom.Node node)
                           throws CanonicalizationException
Canonicalizes the subtree rooted by node.

Parameters:
node -
Throws:
CanonicalizationException

canonicalizeSubtree

public byte[] canonicalizeSubtree(org.w3c.dom.Node node,
                                  java.lang.String inclusiveNamespaces)
                           throws CanonicalizationException
Canonicalizes the subtree rooted by node.

Parameters:
node -
inclusiveNamespaces -
Throws:
CanonicalizationException

canonicalizeXPathNodeSet

public byte[] canonicalizeXPathNodeSet(org.w3c.dom.NodeList xpathNodeSet)
                                throws CanonicalizationException
Canonicalizes an XPath node set. The xpathNodeSet is treated as a list of XPath nodes, not as a list of subtrees.

Parameters:
xpathNodeSet -
Throws:
CanonicalizationException

canonicalizeXPathNodeSet

public byte[] canonicalizeXPathNodeSet(org.w3c.dom.NodeList xpathNodeSet,
                                       java.lang.String inclusiveNamespaces)
                                throws CanonicalizationException
Canonicalizes an XPath node set. The xpathNodeSet is treated as a list of XPath nodes, not as a list of subtrees.

Parameters:
xpathNodeSet -
inclusiveNamespaces -
Throws:
CanonicalizationException

canonicalizeXPathNodeSet

public byte[] canonicalizeXPathNodeSet(java.util.Set xpathNodeSet)
                                throws CanonicalizationException
Canonicalizes an XPath node set.

Parameters:
xpathNodeSet -
Throws:
CanonicalizationException

canonicalizeXPathNodeSet

public byte[] canonicalizeXPathNodeSet(java.util.Set xpathNodeSet,
                                       java.lang.String inclusiveNamespaces)
                                throws CanonicalizationException
Canonicalizes an XPath node set.

Parameters:
xpathNodeSet -
inclusiveNamespaces -
Throws:
CanonicalizationException

getImplementingCanonicalizerClass

public java.lang.String getImplementingCanonicalizerClass()
Returns the name of the implementing CanonicalizerSpi class

Returns:
the name of the implementing CanonicalizerSpi class