Skip navigation links

Oracle Fusion Middleware XML Security Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10680-03


oracle.security.xmlsec.c14n
Class Canonicalizer

java.lang.Object
  extended by oracle.security.xmlsec.c14n.Canonicalizer

Direct Known Subclasses:
ExclusiveC14N, StreamingC14NImpl, XMLC14N

public abstract class Canonicalizer
extends java.lang.Object

Abstract base class for canonicalization implementations.


Field Summary
protected  java.lang.String algorithmURI
          The algorithmURI for this
protected  XSAlgorithmIdentifier c14nMethod
          The XSAlgorithmIdentifier instance used to instantiate this Canonicalizer.

 

Constructor Summary
protected Canonicalizer()
          Creates a new Canonicalizer instance.
protected Canonicalizer(XSAlgorithmIdentifier c14nMethod)
          Creates a new Canonicalizer instance, and checks that the given XSAlgorithmIdentifier is a XML-DSIG CanonicalizationMethod element.

 

Method Summary
abstract  byte[] canonicalize(java.util.Collection source)
          Canonicalizes the given Collection, returning the resulting XML octets in UTF-8 encoding.
abstract  byte[] canonicalize(org.xml.sax.InputSource source)
          Canonicalizes the XML in the given InputSource, returning the resulting XML octets in UTF-8 encoding.
abstract  byte[] canonicalize(java.io.InputStream source)
          Canonicalizes the XML in the given input stream, returning the resulting XML octets in UTF-8 encoding.
abstract  byte[] canonicalize(java.io.InputStream source, java.lang.String systemId)
          Canonicalizes the XML in the given input stream, returning the resulting XML octets in UTF-8 encoding.
abstract  byte[] canonicalize(org.w3c.dom.Node source)
          Canonicalizes a DOM subtree rooted in the given Node, returning the resulting XML octets in UTF-8 encoding.
abstract  byte[] canonicalize(org.w3c.dom.NodeList source)
          Canonicalizes the given NodeList, returning the resulting XML octets in UTF-8 encoding.
 java.io.InputStream canonicalizeToStream(java.util.Collection source)
          Canonicalizes the given Collection, returning the resulting XML octets in UTF-8 encoding.
 java.io.InputStream canonicalizeToStream(org.xml.sax.InputSource source)
          Canonicalizes the XML in the given InputSource, returning the resulting XML octets in UTF-8 encoding.
 java.io.InputStream canonicalizeToStream(java.io.InputStream source)
          Canonicalizes the XML in the given input stream, returning the resulting XML octets in UTF-8 encoding.
 java.io.InputStream canonicalizeToStream(java.io.InputStream source, java.lang.String systemId)
          Canonicalizes the XML in the given input stream, returning the resulting XML octets in UTF-8 encoding.
 java.io.InputStream canonicalizeToStream(org.w3c.dom.Node source)
          Canonicalizes a DOM subtree rooted in the given Node, returning the resulting XML octets in UTF-8 encoding.
 java.io.InputStream canonicalizeToStream(org.w3c.dom.NodeList source)
          Canonicalizes the given NodeList, returning the resulting XML octets in UTF-8 encoding.
 java.lang.String getAlgorithURI()
          Return the algorithm URI
 XSAlgorithmIdentifier getC14NMethod()
          Returns the XSAlgorithmIdentifier containing the CanonicalizationMethod element used to instantiate this Canonicalizer.
 java.lang.String getInclusiveNSPrefixList()
          Returns the value of the InclusiveNamespaces parameter's PrefixList attribute.
static Canonicalizer getInstance(boolean inclusive, boolean withComments)
           
static Canonicalizer getInstance(boolean inclusive, boolean withComments, boolean c14n11)
           
static Canonicalizer getInstance(java.lang.String uri)
          Creates a new Canonicalizer implementation class identified by the given algorithm URI.
static Canonicalizer getInstance(XSAlgorithmIdentifier c14nMethod)
          Returns an instance of the Canonicalizer subclass identified by the given XSAlgorithmIdentifier's Algorithm attribute.
 void setInclusiveNSPrefixList(java.lang.String nsPrefixList)
          Sets the value of the InclusiveNamespaces parameter's PrefixList attribute.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

c14nMethod

protected XSAlgorithmIdentifier c14nMethod
The XSAlgorithmIdentifier instance used to instantiate this Canonicalizer.

algorithmURI

protected java.lang.String algorithmURI
The algorithmURI for this

Constructor Detail

Canonicalizer

protected Canonicalizer()
Creates a new Canonicalizer instance.

Canonicalizer

protected Canonicalizer(XSAlgorithmIdentifier c14nMethod)
Creates a new Canonicalizer instance, and checks that the given XSAlgorithmIdentifier is a XML-DSIG CanonicalizationMethod element. Subclasses should invoke this constructor as needed.
Parameters:
c14nMethod - A XSAlgorithmIdentifier with local tag name "CanonicalizationMethod".
Throws:
java.lang.IllegalArgumentException - If the given XSAlgorithmIdentifier is not a XML-DSIG CanonicalizationMethod.

Method Detail

getC14NMethod

public XSAlgorithmIdentifier getC14NMethod()
Returns the XSAlgorithmIdentifier containing the CanonicalizationMethod element used to instantiate this Canonicalizer.
Returns:
A XSAlgorithmIdentifier, or null if none has been set.

getAlgorithURI

public java.lang.String getAlgorithURI()
Return the algorithm URI
Returns:

getInstance

public static Canonicalizer getInstance(XSAlgorithmIdentifier c14nMethod)
                                 throws oracle.security.crypto.core.AlgorithmIdentifierException
Returns an instance of the Canonicalizer subclass identified by the given XSAlgorithmIdentifier's Algorithm attribute.
Parameters:
c14nMethod - A XSAlgorithmIdentifier object containing the algorithm identifying the desired canonicalization, and any parameters required by the algorithm. If any parameters are specified in the XSAlgorithmIdentifier structure, the algorithm's target implementation class must have an accessible constructor taking a XSAlgorithmIdentifier as its only argument.
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException - If a Canonicalizer cannot be instantiated for the given algorithm.
java.lang.IllegalArgumentException - If the given XSAlgorithmIdentifier is not a CanonicalizationMethod or it contains more than one parameter.

getInstance

public static Canonicalizer getInstance(java.lang.String uri)
                                 throws oracle.security.crypto.core.AlgorithmIdentifierException
Creates a new Canonicalizer implementation class identified by the given algorithm URI.

Standard algorithm URI constants can be found in XMLURI, including:

Parameters:
uri - A URI string identifying the algorithm of the canonicalization implementation class to be instantiated.
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException - If a Canonicalizer cannot be instantiated for the given algorithm.

getInstance

public static Canonicalizer getInstance(boolean inclusive,
                                        boolean withComments)

getInstance

public static Canonicalizer getInstance(boolean inclusive,
                                        boolean withComments,
                                        boolean c14n11)

setInclusiveNSPrefixList

public void setInclusiveNSPrefixList(java.lang.String nsPrefixList)
Sets the value of the InclusiveNamespaces parameter's PrefixList attribute. Only applicable for exclusive C14n

getInclusiveNSPrefixList

public java.lang.String getInclusiveNSPrefixList()
Returns the value of the InclusiveNamespaces parameter's PrefixList attribute. Only applicable for exclusive C14n

canonicalize

public abstract byte[] canonicalize(org.w3c.dom.Node source)
                             throws CanonicalizationException
Canonicalizes a DOM subtree rooted in the given Node, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - An org.w3c.dom.Node at the root of a XML tree to be canonicalized.
Returns:
A byte array containing the canonicalized octets of the input XML tree.
Throws:
CanonicalizationException

canonicalizeToStream

public java.io.InputStream canonicalizeToStream(org.w3c.dom.Node source)
                                         throws CanonicalizationException
Canonicalizes a DOM subtree rooted in the given Node, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - An org.w3c.dom.Node at the root of a XML tree to be canonicalized.
Returns:
A byte array containing the canonicalized octets of the input XML tree.
Throws:
CanonicalizationException

canonicalize

public abstract byte[] canonicalize(org.w3c.dom.NodeList source)
                             throws CanonicalizationException
Canonicalizes the given NodeList, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - An org.w3c.dom.NodeList to be canonicalized.
Returns:
A byte array containing the canonicalized octets of the input node list.
Throws:
CanonicalizationException

canonicalizeToStream

public java.io.InputStream canonicalizeToStream(org.w3c.dom.NodeList source)
                                         throws CanonicalizationException
Canonicalizes the given NodeList, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - An org.w3c.dom.NodeList to be canonicalized.
Returns:
An InputStream containing the canonicalized octets of the input node list.
Throws:
CanonicalizationException

canonicalize

public abstract byte[] canonicalize(java.util.Collection source)
                             throws CanonicalizationException
Canonicalizes the given Collection, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - A java.util.Collection containing the nodes to be canonicalized.
Returns:
A byte array containing the canonicalized octets of the input nodes.
Throws:
CanonicalizationException
Since:
2.0

canonicalizeToStream

public java.io.InputStream canonicalizeToStream(java.util.Collection source)
                                         throws CanonicalizationException
Canonicalizes the given Collection, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - A java.util.Collection containing the nodes to be canonicalized.
Returns:
A byte array containing the canonicalized octets of the input nodes.
Throws:
CanonicalizationException
Since:
2.0

canonicalize

public abstract byte[] canonicalize(java.io.InputStream source)
                             throws CanonicalizationException
Canonicalizes the XML in the given input stream, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - A java.io.InputStream containing the XML to be canonicalized.
Returns:
A byte array containing the canonicalized octets of the input XML.
Throws:
CanonicalizationException

canonicalizeToStream

public java.io.InputStream canonicalizeToStream(java.io.InputStream source)
                                         throws CanonicalizationException
Canonicalizes the XML in the given input stream, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - A java.io.InputStream containing the XML to be canonicalized.
Returns:
An InputStream containing the canonicalized octets of the input XML.
Throws:
CanonicalizationException

canonicalize

public abstract byte[] canonicalize(java.io.InputStream source,
                                    java.lang.String systemId)
                             throws CanonicalizationException
Canonicalizes the XML in the given input stream, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - A java.io.InputStream containing the XML to be canonicalized.
systemId - A URI string identifying the input stream source.
Returns:
A byte array containing the canonicalized octets of the input XML.
Throws:
CanonicalizationException

canonicalizeToStream

public java.io.InputStream canonicalizeToStream(java.io.InputStream source,
                                                java.lang.String systemId)
                                         throws CanonicalizationException
Canonicalizes the XML in the given input stream, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - A java.io.InputStream containing the XML to be canonicalized.
systemId - A URI string identifying the input stream source.
Returns:
An input stream containing the canonicalized octets of the input XML.
Throws:
CanonicalizationException

canonicalize

public abstract byte[] canonicalize(org.xml.sax.InputSource source)
                             throws CanonicalizationException
Canonicalizes the XML in the given InputSource, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - An org.xml.sax.InputSource containing the XML to be canonicalized.
Returns:
A byte array containing the canonicalized octets of the input XML.
Throws:
CanonicalizationException

canonicalizeToStream

public java.io.InputStream canonicalizeToStream(org.xml.sax.InputSource source)
                                         throws CanonicalizationException
Canonicalizes the XML in the given InputSource, returning the resulting XML octets in UTF-8 encoding.
Parameters:
source - An org.xml.sax.InputSource containing the XML to be canonicalized.
Returns:
A input stream containing the canonicalized octets of the input XML.
Throws:
CanonicalizationException

Skip navigation links

Oracle Fusion Middleware XML Security Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10680-03


Copyright © 2005, 2011 , Oracle. All rights reserved.