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 Object
The XMLSignature Input
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedXMLSignatureInput()Construct a XMLSignatureInputprotectedXMLSignatureInput(Set<Node> nodeSet)protectedXMLSignatureInput(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(OutputStream output, boolean c14n11)Canonicalizes this object to the output stream.protected abstract 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.NodegetExcludeNode()Set<Node>getInputNodeSet()Get the Input NodeSet.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.List<NodeFilter>getNodeFilters()Set<Node>getNodeSet()Returns the node set from input which was specified as the parameter ofXMLSignatureInputconstructorOutputStreamgetOutputStream()StringgetPreCalculatedDigest()StringgetSourceURI()NodegetSubNode()Gets the node of this XMLSignatureInputabstract InputStreamgetUnprocessedInput()abstract booleanhasUnprocessedInput()booleanisElement()Determines if the object has been set up with an ElementbooleanisExcludeComments()booleanisNeedsToBeExpanded()booleanisNodeSet()booleanisOutputStreamSet()booleanisSecureValidation()voidsetExcludeComments(boolean excludeComments)voidsetExcludeNode(Node excludeNode)Sets the exclude node of this XMLSignatureInputvoidsetMIMEType(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(OutputStream outputStream)voidsetSecureValidation(boolean secureValidation)Set to false to disable validation in r/w operations.voidsetSourceURI(String sourceURI)StringtoString()Creates a short description of this instance.voidwrite(OutputStream output)Writes the data to the output stream.abstract voidwrite(OutputStream output, boolean c14n11)Writes the data to the output stream.
-
-
-
Constructor Detail
-
XMLSignatureInput
protected XMLSignatureInput()
Construct a XMLSignatureInput
-
XMLSignatureInput
protected XMLSignatureInput(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-
-
-
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 InputStream getUnprocessedInput() throws IOException
- Returns:
- the
InputStreamfrom input which was specified as the parameter ofXMLSignatureInputconstructor - Throws:
IOException
-
convertToNode
protected abstract Node convertToNode() throws org.apache.xml.security.parser.XMLParserException, IOException
- Returns:
- data given in constructor converted to a
Nodeor null if such conversion is not supported by thisXMLSignatureInput - Throws:
org.apache.xml.security.parser.XMLParserExceptionIOException
-
write
public void write(OutputStream output) throws CanonicalizationException, IOException
Writes the data to the output stream.- Parameters:
output-- Throws:
CanonicalizationExceptionIOException
-
write
public abstract void write(OutputStream output, boolean c14n11) throws CanonicalizationException, IOException
Writes the data to the output stream.- Parameters:
output-c14n11-- Throws:
CanonicalizationExceptionIOException- See Also:
- XmlDSig-Core Reference Generation
-
getInputNodeSet
public Set<Node> getInputNodeSet()
Get the Input NodeSet.- Returns:
- the Input NodeSet.
-
getNodeSet
public Set<Node> getNodeSet() throws org.apache.xml.security.parser.XMLParserException, IOException
Returns 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:
org.apache.xml.security.parser.XMLParserExceptionIOException
-
getSubNode
public Node getSubNode()
Gets the node of this XMLSignatureInput- Returns:
- The excludeNode set.
-
addNodeFilter
public void addNodeFilter(NodeFilter filter) throws org.apache.xml.security.parser.XMLParserException, IOException
- Parameters:
filter-- Throws:
org.apache.xml.security.parser.XMLParserExceptionIOException
-
getNodeFilters
public final List<NodeFilter> getNodeFilters()
- Returns:
- the node filters
-
setNodeSet
public final void setNodeSet(boolean nodeSet)
- Parameters:
nodeSet-
-
getBytes
public byte[] getBytes() throws 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:
CanonicalizationExceptionIOException
-
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 String getPreCalculatedDigest()
- Returns:
- String given through constructor. Null by default, see extensions of this class.
-
getExcludeNode
public Node getExcludeNode()
- Returns:
- the exclude node of this XMLSignatureInput
-
setExcludeNode
public void setExcludeNode(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 String getSourceURI()
- Returns:
- Source URI
-
setSourceURI
public void setSourceURI(String sourceURI)
- Parameters:
sourceURI-
-
getMIMEType
public 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(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(OutputStream outputStream)
- Parameters:
outputStream- this stream will be ignored inwrite(OutputStream)method
-
getOutputStream
public OutputStream getOutputStream()
- Returns:
OutputStreamset insetOutputStream(OutputStream)
-
toString
public String toString()
Creates a short description of this instance.
-
canonicalize
protected void canonicalize(OutputStream output, boolean c14n11) throws CanonicalizationException, IOException
Canonicalizes this object to the output stream.- Parameters:
c14n11-output-- Throws:
CanonicalizationExceptionIOException
-
-