Module org.apache.santuario.xmlsec
Class XMLSignatureInput
- java.lang.Object
-
- org.apache.xml.security.signature.XMLSignatureInput
-
- Direct Known Subclasses:
XMLSignatureByteInput,XMLSignatureDigestInput,XMLSignatureNodeInput,XMLSignatureNodeSetInput,XMLSignatureStreamInput
public abstract class XMLSignatureInput extends java.lang.ObjectThe XMLSignature Input
-
-
Field Summary
Fields Modifier and Type Field Description private booleanexcludeCommentsprivate org.w3c.dom.NodeexcludeNodeExclude Node *for enveloped transformationsprivate java.util.Set<org.w3c.dom.Node>inputNodeSetThe original set from the constructor.private booleanisNodeSetprivate java.lang.StringmimeTypeprivate booleanneedsToBeExpandedprivate java.util.List<NodeFilter>nodeFiltersNode Filter list.private java.io.OutputStreamoutputStreamprivate booleansecureValidationprivate java.lang.StringsourceURIprivate org.w3c.dom.NodesubNodeThe original Element
-
Constructor Summary
Constructors Modifier Constructor Description protectedXMLSignatureInput()Construct a XMLSignatureInputprotectedXMLSignatureInput(java.util.Set<org.w3c.dom.Node> nodeSet)Construct a XMLSignatureInput from aSetofNodes.protectedXMLSignatureInput(org.w3c.dom.Node rootNode)Construct a XMLSignatureInput from a subtree rooted by rootNode.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddNodeFilter(NodeFilter filter)protected voidcanonicalize(java.io.OutputStream output, boolean c14n11)Canonicalizes this object to the output stream.protected abstract org.w3c.dom.NodeconvertToNode()byte[]getBytes()Returns the byte array from input which was specified as the parameter ofXMLSignatureInputconstructor OR tries to reconstruct that if the element or node was already processed.org.w3c.dom.NodegetExcludeNode()java.util.Set<org.w3c.dom.Node>getInputNodeSet()Get the Input NodeSet.java.lang.StringgetMIMEType()Some Transforms may require explicit MIME type, charset (IANA registered "character set"), or other such information concerning the data they are receiving from an earlier Transform or the source data, although no Transform algorithm specified in this document needs such explicit information.java.util.List<NodeFilter>getNodeFilters()java.util.Set<org.w3c.dom.Node>getNodeSet()Returns the node set from input which was specified as the parameter ofXMLSignatureInputconstructorprivate java.util.Set<org.w3c.dom.Node>getNodeSet(boolean circumvent)Returns the node set from input which was specified as the parameter ofXMLSignatureInputconstructorjava.io.OutputStreamgetOutputStream()java.lang.StringgetPreCalculatedDigest()java.lang.StringgetSourceURI()org.w3c.dom.NodegetSubNode()Gets the node of this XMLSignatureInputabstract java.io.InputStreamgetUnprocessedInput()abstract booleanhasUnprocessedInput()booleanisElement()Determines if the object has been set up with an ElementbooleanisExcludeComments()booleanisNeedsToBeExpanded()booleanisNodeSet()booleanisOutputStreamSet()booleanisSecureValidation()voidsetExcludeComments(boolean excludeComments)voidsetExcludeNode(org.w3c.dom.Node excludeNode)Sets the exclude node of this XMLSignatureInputvoidsetMIMEType(java.lang.String mimeType)Some Transforms may require explicit MIME type, charset (IANA registered "character set"), or other such information concerning the data they are receiving from an earlier Transform or the source data, although no Transform algorithm specified in this document needs such explicit information.voidsetNeedsToBeExpanded(boolean needsToBeExpanded)Set if the structure needs to be expanded.voidsetNodeSet(boolean nodeSet)voidsetOutputStream(java.io.OutputStream outputStream)voidsetSecureValidation(boolean secureValidation)Set to false to disable validation in r/w operations.voidsetSourceURI(java.lang.String sourceURI)java.lang.StringtoString()Creates a short description of this instance.voidwrite(java.io.OutputStream output)Writes the data to the output stream.abstract voidwrite(java.io.OutputStream output, boolean c14n11)Writes the data to the output stream.
-
-
-
Field Detail
-
inputNodeSet
private java.util.Set<org.w3c.dom.Node> inputNodeSet
The original set from the constructor.
-
subNode
private org.w3c.dom.Node subNode
The original Element
-
isNodeSet
private boolean isNodeSet
-
nodeFilters
private final java.util.List<NodeFilter> nodeFilters
Node Filter list.
-
excludeNode
private org.w3c.dom.Node excludeNode
Exclude Node *for enveloped transformations
-
excludeComments
private boolean excludeComments
-
sourceURI
private java.lang.String sourceURI
-
mimeType
private java.lang.String mimeType
-
needsToBeExpanded
private boolean needsToBeExpanded
-
secureValidation
private boolean secureValidation
-
outputStream
private java.io.OutputStream outputStream
-
-
Constructor Detail
-
XMLSignatureInput
protected XMLSignatureInput()
Construct a XMLSignatureInput
-
XMLSignatureInput
protected XMLSignatureInput(org.w3c.dom.Node rootNode)
Construct a XMLSignatureInput from a subtree rooted by rootNode. This method included the node and all its descendants in the output.- Parameters:
rootNode-
-
XMLSignatureInput
protected XMLSignatureInput(java.util.Set<org.w3c.dom.Node> nodeSet)
Construct a XMLSignatureInput from aSetofNodes.- Parameters:
nodeSet-
-
-
Method Detail
-
hasUnprocessedInput
public abstract boolean hasUnprocessedInput()
- Returns:
- true if this instance still can provide the unprocessed input
which was specified as the parameter of
XMLSignatureInput
-
getUnprocessedInput
public abstract java.io.InputStream getUnprocessedInput() throws java.io.IOException- Returns:
- the
InputStreamfrom input which was specified as the parameter ofXMLSignatureInputconstructor - Throws:
java.io.IOException
-
convertToNode
protected abstract org.w3c.dom.Node convertToNode() throws XMLParserException, java.io.IOException- Returns:
- data given in constructor converted to a
Nodeor null if such conversion is not supported by thisXMLSignatureInput - Throws:
XMLParserExceptionjava.io.IOException
-
write
public void write(java.io.OutputStream output) throws CanonicalizationException, java.io.IOExceptionWrites the data to the output stream.- Parameters:
output-- Throws:
CanonicalizationExceptionjava.io.IOException
-
write
public abstract void write(java.io.OutputStream output, boolean c14n11) throws CanonicalizationException, java.io.IOExceptionWrites the data to the output stream.- Parameters:
output-c14n11-- Throws:
CanonicalizationExceptionjava.io.IOException- See Also:
- XmlDSig-Core Reference Generation
-
getInputNodeSet
public java.util.Set<org.w3c.dom.Node> getInputNodeSet()
Get the Input NodeSet.- Returns:
- the Input NodeSet.
-
getNodeSet
public java.util.Set<org.w3c.dom.Node> getNodeSet() throws XMLParserException, java.io.IOExceptionReturns the node set from input which was specified as the parameter ofXMLSignatureInputconstructorCan call the
convertToNode()to parse theNodefrom the input data. The internal state will change then.- Returns:
- the node set
- Throws:
XMLParserExceptionjava.io.IOException
-
getNodeSet
private java.util.Set<org.w3c.dom.Node> getNodeSet(boolean circumvent) throws XMLParserException, java.io.IOExceptionReturns the node set from input which was specified as the parameter ofXMLSignatureInputconstructorCan call the
convertToNode()to parse theNodefrom the input data. The internal state will change then.- Parameters:
circumvent-- Returns:
- the node set
- Throws:
XMLParserExceptionjava.io.IOException
-
getSubNode
public org.w3c.dom.Node getSubNode()
Gets the node of this XMLSignatureInput- Returns:
- The excludeNode set.
-
addNodeFilter
public void addNodeFilter(NodeFilter filter) throws XMLParserException, java.io.IOException
- Parameters:
filter-- Throws:
XMLParserExceptionjava.io.IOException
-
getNodeFilters
public final java.util.List<NodeFilter> getNodeFilters()
- Returns:
- the node filters
-
setNodeSet
public final void setNodeSet(boolean nodeSet)
- Parameters:
nodeSet-
-
getBytes
public byte[] getBytes() throws java.io.IOException, CanonicalizationExceptionReturns the byte array from input which was specified as the parameter ofXMLSignatureInputconstructor OR tries to reconstruct that if the element or node was already processed.- Returns:
- the byte array
- Throws:
CanonicalizationExceptionjava.io.IOException
-
isNodeSet
public boolean isNodeSet()
- Returns:
- true if the
XMLSignatureInput(Set)was used or the node set was parsed from an input coming from another constructor.
-
isElement
public boolean isElement()
Determines if the object has been set up with an Element- Returns:
- true if the object has been set up with an Element
-
getPreCalculatedDigest
public java.lang.String getPreCalculatedDigest()
- Returns:
- String given through constructor. Null by default, see extensions of this class.
-
getExcludeNode
public org.w3c.dom.Node getExcludeNode()
- Returns:
- the exclude node of this XMLSignatureInput
-
setExcludeNode
public void setExcludeNode(org.w3c.dom.Node excludeNode)
Sets the exclude node of this XMLSignatureInput- Parameters:
excludeNode- The excludeNode to set.
-
isExcludeComments
public boolean isExcludeComments()
- Returns:
- Returns the excludeComments.
-
setExcludeComments
public void setExcludeComments(boolean excludeComments)
- Parameters:
excludeComments- The excludeComments to set.
-
getSourceURI
public java.lang.String getSourceURI()
- Returns:
- Source URI
-
setSourceURI
public void setSourceURI(java.lang.String sourceURI)
- Parameters:
sourceURI-
-
getMIMEType
public java.lang.String getMIMEType()
Some Transforms may require explicit MIME type, charset (IANA registered "character set"), or other such information concerning the data they are receiving from an earlier Transform or the source data, although no Transform algorithm specified in this document needs such explicit information.Such data characteristics are provided as parameters to the Transform algorithm and should be described in the specification for the algorithm.
- Returns:
- mimeType
-
setMIMEType
public void setMIMEType(java.lang.String mimeType)
Some Transforms may require explicit MIME type, charset (IANA registered "character set"), or other such information concerning the data they are receiving from an earlier Transform or the source data, although no Transform algorithm specified in this document needs such explicit information.Such data characteristics are provided as parameters to the Transform algorithm and should be described in the specification for the algorithm.
- Parameters:
mimeType-
-
isNeedsToBeExpanded
public boolean isNeedsToBeExpanded()
- Returns:
- true if the structure needs to be expanded.
-
setNeedsToBeExpanded
public void setNeedsToBeExpanded(boolean needsToBeExpanded)
Set if the structure needs to be expanded.- Parameters:
needsToBeExpanded- true if so.
-
isSecureValidation
public boolean isSecureValidation()
- Returns:
- true by default, enabled validation in r/w operations
-
setSecureValidation
public void setSecureValidation(boolean secureValidation)
Set to false to disable validation in r/w operations.- Parameters:
secureValidation- default is true.
-
isOutputStreamSet
public boolean isOutputStreamSet()
- Returns:
- true if
setOutputStream(java.io.OutputStream)has been called with a non-null OutputStream
-
setOutputStream
public void setOutputStream(java.io.OutputStream outputStream)
- Parameters:
outputStream- this stream will be ignored inwrite(OutputStream)method
-
getOutputStream
public java.io.OutputStream getOutputStream()
- Returns:
OutputStreamset insetOutputStream(OutputStream)
-
toString
public java.lang.String toString()
Creates a short description of this instance.- Overrides:
toStringin classjava.lang.Object
-
canonicalize
protected void canonicalize(java.io.OutputStream output, boolean c14n11) throws CanonicalizationException, java.io.IOExceptionCanonicalizes this object to the output stream.- Parameters:
c14n11-output-- Throws:
CanonicalizationExceptionjava.io.IOException
-
-