- java.lang.Object
-
- org.apache.xml.security.c14n.Canonicalizer
-
public final class Canonicalizer extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringALGO_ID_C14N_EXCL_OMIT_COMMENTSThe URL defined in XML-SEC Rec for exclusive c14n without comments.static StringALGO_ID_C14N_EXCL_WITH_COMMENTSThe URL defined in XML-SEC Rec for exclusive c14n with comments.static StringALGO_ID_C14N_OMIT_COMMENTSThe URL defined in XML-SEC Rec for inclusive c14n without comments.static StringALGO_ID_C14N_PHYSICALNon-standard algorithm to serialize the physical representation for XML Encryptionstatic StringALGO_ID_C14N_WITH_COMMENTSThe URL defined in XML-SEC Rec for inclusive c14n with comments.static StringALGO_ID_C14N11_OMIT_COMMENTSThe URI for inclusive c14n 1.1 without comments.static StringALGO_ID_C14N11_WITH_COMMENTSThe URI for inclusive c14n 1.1 with comments.static StringENCODINGThe output encoding of canonicalized datastatic StringXPATH_C14N_WITH_COMMENTS_SINGLE_NODEXPath Expression for selecting every node and continuous comments joined in only one node
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcanonicalize(byte[] inputBytes, OutputStream writer, boolean secureValidation)This method tries to canonicalize the given bytes.voidcanonicalizeSubtree(Node node, OutputStream writer)Canonicalizes the subtree rooted bynode.voidcanonicalizeSubtree(Node node, String inclusiveNamespaces, boolean propagateDefaultNamespace, OutputStream writer)Canonicalizes the subtree rooted bynode.voidcanonicalizeSubtree(Node node, String inclusiveNamespaces, OutputStream writer)Canonicalizes the subtree rooted bynode.voidcanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, OutputStream writer)Canonicalizes an XPath node set.voidcanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces, OutputStream writer)Canonicalizes an XPath node set.static CanonicalizergetInstance(String algorithmURI)Method getInstancestatic voidregister(String algorithmURI, Class<? extends CanonicalizerSpi> implementingClass)Method registerstatic voidregister(String algorithmURI, String implementingClass)Method registerstatic voidregisterDefaultAlgorithms()This method registers the default algorithms.
-
-
-
Field Detail
-
ENCODING
public static final String ENCODING
The output encoding of canonicalized data
-
XPATH_C14N_WITH_COMMENTS_SINGLE_NODE
public static final String XPATH_C14N_WITH_COMMENTS_SINGLE_NODE
XPath Expression for selecting every node and continuous comments joined in only one node- See Also:
- Constant Field Values
-
ALGO_ID_C14N_OMIT_COMMENTS
public static final String ALGO_ID_C14N_OMIT_COMMENTS
The URL defined in XML-SEC Rec for inclusive c14n without comments.- See Also:
- Constant Field Values
-
ALGO_ID_C14N_WITH_COMMENTS
public static final String ALGO_ID_C14N_WITH_COMMENTS
The URL defined in XML-SEC Rec for inclusive c14n with comments.- See Also:
- Constant Field Values
-
ALGO_ID_C14N_EXCL_OMIT_COMMENTS
public static final String ALGO_ID_C14N_EXCL_OMIT_COMMENTS
The URL defined in XML-SEC Rec for exclusive c14n without comments.- See Also:
- Constant Field Values
-
ALGO_ID_C14N_EXCL_WITH_COMMENTS
public static final String ALGO_ID_C14N_EXCL_WITH_COMMENTS
The URL defined in XML-SEC Rec for exclusive c14n with comments.- See Also:
- Constant Field Values
-
ALGO_ID_C14N11_OMIT_COMMENTS
public static final String ALGO_ID_C14N11_OMIT_COMMENTS
The URI for inclusive c14n 1.1 without comments.- See Also:
- Constant Field Values
-
ALGO_ID_C14N11_WITH_COMMENTS
public static final String ALGO_ID_C14N11_WITH_COMMENTS
The URI for inclusive c14n 1.1 with comments.- See Also:
- Constant Field Values
-
ALGO_ID_C14N_PHYSICAL
public static final String ALGO_ID_C14N_PHYSICAL
Non-standard algorithm to serialize the physical representation for XML Encryption- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static Canonicalizer getInstance(String algorithmURI) throws InvalidCanonicalizerException
Method getInstance- Parameters:
algorithmURI-- Returns:
- a Canonicalizer instance ready for the job
- Throws:
InvalidCanonicalizerException
-
register
public static void register(String algorithmURI, String implementingClass) throws AlgorithmAlreadyRegisteredException, ClassNotFoundException
Method register- Parameters:
algorithmURI-implementingClass-- Throws:
AlgorithmAlreadyRegisteredExceptionSecurityException- if a security manager is installed and the caller does not have permission to register the canonicalizerClassNotFoundException
-
register
public static void register(String algorithmURI, Class<? extends CanonicalizerSpi> implementingClass) throws AlgorithmAlreadyRegisteredException, ClassNotFoundException
Method register- Parameters:
algorithmURI-implementingClass-- Throws:
AlgorithmAlreadyRegisteredExceptionSecurityException- if a security manager is installed and the caller does not have permission to register the canonicalizerClassNotFoundException
-
registerDefaultAlgorithms
public static void registerDefaultAlgorithms()
This method registers the default algorithms.
-
canonicalize
public void canonicalize(byte[] inputBytes, OutputStream writer, boolean secureValidation) throws org.apache.xml.security.parser.XMLParserException, IOException, CanonicalizationExceptionThis 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-writer- OutputStream to write the canonicalization resultsecureValidation- Whether secure validation is enabled- Throws:
CanonicalizationExceptionIOExceptionorg.apache.xml.security.parser.XMLParserException
-
canonicalizeSubtree
public void canonicalizeSubtree(Node node, OutputStream writer) throws CanonicalizationException
Canonicalizes the subtree rooted bynode.- Parameters:
node- The node to canonicalizewriter- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
canonicalizeSubtree
public void canonicalizeSubtree(Node node, String inclusiveNamespaces, OutputStream writer) throws CanonicalizationException
Canonicalizes the subtree rooted bynode.- Parameters:
node-inclusiveNamespaces-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
canonicalizeSubtree
public void canonicalizeSubtree(Node node, String inclusiveNamespaces, boolean propagateDefaultNamespace, OutputStream writer) throws CanonicalizationException
Canonicalizes the subtree rooted bynode.- Parameters:
node-inclusiveNamespaces-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
canonicalizeXPathNodeSet
public void canonicalizeXPathNodeSet(Set<Node> xpathNodeSet, OutputStream writer) throws CanonicalizationException
Canonicalizes an XPath node set.- Parameters:
xpathNodeSet-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
canonicalizeXPathNodeSet
public void canonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces, OutputStream writer) throws CanonicalizationException
Canonicalizes an XPath node set.- Parameters:
xpathNodeSet-inclusiveNamespaces-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
-