public final class XmlSignatureHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
XmlSignatureHelper.XPathAndFilter |
Modifier and Type | Method and Description |
---|---|
static AlgorithmMethod |
getBase64Transform()
Returns a configuration for a base64 transformation.
|
static AlgorithmMethod |
getCanonicalizationMethod(String algorithm)
Returns a configuration for a canonicalization algorithm.
|
static AlgorithmMethod |
getCanonicalizationMethod(String algorithm,
List<String> inclusiveNamespacePrefixes)
Returns a configuration for a canonicalization algorithm.
|
static Document |
getDocument(Node node) |
static AlgorithmMethod |
getEnvelopedTransform() |
static List<Node> |
getTextAndElementChildren(Node node) |
static List<AlgorithmMethod> |
getTransforms(List<AlgorithmMethod> list) |
static AlgorithmMethod |
getXPath2Transform(List<XmlSignatureHelper.XPathAndFilter> xpathAndFilterList)
Returns a configuration for an XPATH2 transformation which consists of several XPATH expressions.
|
static AlgorithmMethod |
getXPath2Transform(List<XmlSignatureHelper.XPathAndFilter> xpathAndFilterList,
Map<String,String> namespaceMap)
Returns a configuration for an XPATH2 transformation which consists of several XPATH expressions.
|
static AlgorithmMethod |
getXPath2Transform(String xpath,
String filter)
Returns a configuration for an XPATH2 transformation.
|
static AlgorithmMethod |
getXPath2Transform(String xpath,
String filter,
Map<String,String> namespaceMap)
Returns a configuration for an XPATH2 transformation which consists of several XPATH expressions.
|
static XPathExpression |
getXPathExpression(XPathFilterParameterSpec xpathFilter) |
static XPathFilterParameterSpec |
getXpathFilter(String xpath) |
static XPathFilterParameterSpec |
getXpathFilter(String xpath,
Map<String,String> namespaceMap) |
static AlgorithmMethod |
getXPathTransform(String xpath)
Returns a configuration for an XPATH transformation.
|
static AlgorithmMethod |
getXPathTransform(String xpath,
Map<String,String> namespaceMap)
Returns a configuration for an XPATH transformation which needs a namespace map.
|
static AlgorithmMethod |
getXslTranform(InputStream is)
Returns a configuration for an XSL transformation.
|
static AlgorithmMethod |
getXslTransform(String path)
Returns a configuration for an XSL transformation.
|
static DocumentBuilder |
newDocumentBuilder(Boolean disallowDoctypeDecl) |
static DocumentBuilder |
newDocumentBuilder(Boolean disallowDoctypeDecl,
Schema schema) |
protected static InputStream |
readXslTransform(String path) |
static byte[] |
tranformTextNodeToByteArray(Node node)
Deprecated.
|
static byte[] |
tranformTextNodeToByteArray(Node node,
String encoding)
Trannsforms a text node to byte array using a certain character encoding.
|
static void |
transformNonTextNodeToOutputStream(Node node,
OutputStream os,
boolean omitXmlDeclaration)
Deprecated.
|
static void |
transformNonTextNodeToOutputStream(Node node,
OutputStream os,
boolean omitXmlDeclaration,
String encoding)
Serializes a node using a certain character encoding.
|
static void |
transformToOutputStream(Node node,
OutputStream os,
boolean omitXmlDeclaration)
Deprecated.
|
static void |
transformToOutputStream(Node node,
OutputStream os,
boolean omitXmlDeclaration,
String encoding) |
public static AlgorithmMethod getCanonicalizationMethod(String algorithm)
algorithm
- algorithm URIIllegalArgumentException
- if algorithm is null
public static AlgorithmMethod getCanonicalizationMethod(String algorithm, List<String> inclusiveNamespacePrefixes)
algorithm
- algorithm URIinclusiveNamespacePrefixes
- namespace prefixes which should be treated like in the inclusive
canonicalization, only relevant if the algorithm is exclusiveIllegalArgumentException
- if algorithm is null
public static AlgorithmMethod getEnvelopedTransform()
public static AlgorithmMethod getBase64Transform()
public static AlgorithmMethod getXPathTransform(String xpath)
xpath
- XPATH expressionIllegalArgumentException
- if xpath is null
public static AlgorithmMethod getXPathTransform(String xpath, Map<String,String> namespaceMap)
xpath
- XPATH expressionnamespaceMap
- namespace map, key is the prefix, value is the namespace, can be
null
IllegalArgumentException
- if xpath is null
public static XPathFilterParameterSpec getXpathFilter(String xpath, Map<String,String> namespaceMap)
public static XPathFilterParameterSpec getXpathFilter(String xpath)
public static XPathExpression getXPathExpression(XPathFilterParameterSpec xpathFilter) throws XPathExpressionException
XPathExpressionException
public static AlgorithmMethod getXPath2Transform(String xpath, String filter)
xpath
- XPATH expressionfilter
- possible values are "intersect", "subtract", "union"IllegalArgumentException
- if xpath or filter is null
, or is neither
"intersect", nor "subtract", nor "union"public static AlgorithmMethod getXPath2Transform(String xpath, String filter, Map<String,String> namespaceMap)
namespaceMap
- namespace map, key is the prefix, value is the namespace, can be
null
IllegalArgumentException
- if xpathAndFilterList is null
or empty, or the specified
filter values are neither "intersect", nor "subtract", nor "union"public static AlgorithmMethod getXPath2Transform(List<XmlSignatureHelper.XPathAndFilter> xpathAndFilterList, Map<String,String> namespaceMap)
xpathAndFilterList
- list of XPATH expressions with their filtersnamespaceMap
- namespace map, key is the prefix, value is the namespace, can be
null
IllegalArgumentException
- if xpathAndFilterList is null
or empty, or the specified
filter values are neither "intersect", nor "subtract", nor "union"public static AlgorithmMethod getXPath2Transform(List<XmlSignatureHelper.XPathAndFilter> xpathAndFilterList)
xpathAndFilterList
- list of XPATH expressions with their filtersIllegalArgumentException
- if xpathAndFilterList is null
or empty, or the specified
filte values are neither "intersect", nor "subtract", nor "union"public static AlgorithmMethod getXslTransform(String path) throws Exception
path
- path to the XSL file in the classpathIllegalArgumentException
- if path is null
IllegalStateException
- if the XSL file cannot be foundException
- if an error during the reading of the XSL file occurspublic static AlgorithmMethod getXslTranform(InputStream is) throws SAXException, IOException, ParserConfigurationException
is
- input stream of the XSLIllegalArgumentException
- if is is null
Exception
- if an error during the reading of the XSL file occursSAXException
IOException
ParserConfigurationException
protected static InputStream readXslTransform(String path) throws Exception
Exception
public static List<AlgorithmMethod> getTransforms(List<AlgorithmMethod> list)
public static DocumentBuilder newDocumentBuilder(Boolean disallowDoctypeDecl) throws ParserConfigurationException
ParserConfigurationException
public static DocumentBuilder newDocumentBuilder(Boolean disallowDoctypeDecl, Schema schema) throws ParserConfigurationException
ParserConfigurationException
public static void transformToOutputStream(Node node, OutputStream os, boolean omitXmlDeclaration, String encoding) throws Exception
Exception
@Deprecated public static void transformToOutputStream(Node node, OutputStream os, boolean omitXmlDeclaration) throws Exception
Exception
@Deprecated public static void transformNonTextNodeToOutputStream(Node node, OutputStream os, boolean omitXmlDeclaration) throws Exception
Exception
public static void transformNonTextNodeToOutputStream(Node node, OutputStream os, boolean omitXmlDeclaration, String encoding) throws Exception
node
- DOM node to serializeos
- output stream, to which the node is serializedomitXmlDeclaration
- indicator whether to omit the XML declaration or notencoding
- character encoding, can be null
, if null
then "UTF-8" is
usedException
@Deprecated public static byte[] tranformTextNodeToByteArray(Node node)
tranformTextNodeToByteArray(Node, String)
instead.public static byte[] tranformTextNodeToByteArray(Node node, String encoding)
node
- text nodeencoding
- character encoding, can be null
, if null
then UTF-8 is
usednull
if the node has not text contentIllegalStateException
- if the encoding is not supportedApache Camel