Class XMLSignatureInput
- java.lang.Object
-
- org.apache.xml.security.signature.XMLSignatureInput
-
public class XMLSignatureInput extends java.lang.ObjectClass XMLSignatureInput $todo$ check whether an XMLSignatureInput can be _both_, octet stream _and_ node set?
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]bytesA cached bytesprivate booleanexcludeCommentsprivate org.w3c.dom.NodeexcludeNodeExclude Node *for enveloped transformations*private java.util.Set<org.w3c.dom.Node>inputNodeSetThe original NodeSet for this XMLSignatureInputprivate java.io.InputStreaminputOctetStreamProxySome InputStreams do not support theInputStream.reset()method, so we read it in completely and work on our Proxy.private booleanisNodeSetprivate java.lang.StringmimeTypeSome 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.private booleanneedsToBeExpandedprivate java.util.List<NodeFilter>nodeFiltersNode Filter list.private java.io.OutputStreamoutputStreamprivate java.lang.StringpreCalculatedDigestPre-calculated digest value of the object in base64.private booleansecureValidationprivate java.lang.StringsourceURIField sourceURIprivate org.w3c.dom.NodesubNodeThe original Element
-
Constructor Summary
Constructors Constructor Description XMLSignatureInput(byte[] inputOctets)Construct a XMLSignatureInput from an octet array.XMLSignatureInput(java.io.InputStream inputOctetStream)Constructs aXMLSignatureInputfrom an octet stream.XMLSignatureInput(java.lang.String preCalculatedDigest)Construct aXMLSignatureInputfrom a known digest value in Base64.XMLSignatureInput(java.util.Set<org.w3c.dom.Node> inputNodeSet)Constructor XMLSignatureInputXMLSignatureInput(org.w3c.dom.Node rootNode)Construct a XMLSignatureInput from a subtree rooted by rootNode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNodeFilter(NodeFilter filter)(package private) voidconvertToNodes()byte[]getBytes()Returns the byte array from input which was specified as the parameter ofXMLSignatureInputconstructorprivate byte[]getBytesFromInputStream()org.w3c.dom.NodegetExcludeNode()Gets the exclude node of this XMLSignatureInputjava.lang.StringgetHTMLRepresentation()Method getHTMLRepresentationjava.lang.StringgetHTMLRepresentation(java.util.Set<java.lang.String> inclusiveNamespaces)Method getHTMLRepresentationjava.util.Set<org.w3c.dom.Node>getInputNodeSet()Get the Input NodeSet.java.lang.StringgetMIMEType()Returns mimeTypejava.util.List<NodeFilter>getNodeFilters()java.util.Set<org.w3c.dom.Node>getNodeSet()Returns the node set from input which was specified as the parameter ofXMLSignatureInputconstructorjava.util.Set<org.w3c.dom.Node>getNodeSet(boolean circumvent)Returns the node set from input which was specified as the parameter ofXMLSignatureInputconstructorjava.io.InputStreamgetOctetStream()Returns the Octet stream(byte Stream) from input which was specified as the parameter ofXMLSignatureInputconstructorjava.io.InputStreamgetOctetStreamReal()java.lang.StringgetPreCalculatedDigest()java.lang.StringgetSourceURI()Return SourceURIorg.w3c.dom.NodegetSubNode()Gets the node of this XMLSignatureInputbooleanisByteArray()Determines if the object has been set up with a ByteArraybooleanisElement()Determines if the object has been set up with an ElementbooleanisExcludeComments()booleanisInitialized()Is the object correctly set up?booleanisNeedsToBeExpanded()Check if the structure needs to be expanded.booleanisNodeSet()Determines if the object has been set up with a Node setbooleanisOctetStream()Determines if the object has been set up with an octet streambooleanisOutputStreamSet()Determines ifsetOutputStream(java.io.OutputStream)has been called with a non-null OutputStream.booleanisPreCalculatedDigest()Determines if the object has been set up with a pre-calculated digest.booleanisSecureValidation()voidsetExcludeComments(boolean excludeComments)voidsetExcludeNode(org.w3c.dom.Node excludeNode)Sets the exclude node of this XMLSignatureInputvoidsetMIMEType(java.lang.String mimeType)Sets mimeTypevoidsetNeedsToBeExpanded(boolean needsToBeExpanded)Set if the structure needs to be expanded.voidsetNodeSet(boolean b)voidsetOutputStream(java.io.OutputStream os)voidsetSecureValidation(boolean secureValidation)voidsetSourceURI(java.lang.String sourceURI)Sets SourceURIjava.lang.StringtoString()Method toStringvoidupdateOutputStream(java.io.OutputStream diOs)voidupdateOutputStream(java.io.OutputStream diOs, boolean c14n11)
-
-
-
Field Detail
-
inputOctetStreamProxy
private java.io.InputStream inputOctetStreamProxy
Some InputStreams do not support theInputStream.reset()method, so we read it in completely and work on our Proxy.
-
inputNodeSet
private java.util.Set<org.w3c.dom.Node> inputNodeSet
The original NodeSet for this XMLSignatureInput
-
subNode
private org.w3c.dom.Node subNode
The original Element
-
excludeNode
private org.w3c.dom.Node excludeNode
Exclude Node *for enveloped transformations*
-
excludeComments
private boolean excludeComments
-
isNodeSet
private boolean isNodeSet
-
bytes
private byte[] bytes
A cached bytes
-
secureValidation
private boolean secureValidation
-
mimeType
private 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.
-
sourceURI
private java.lang.String sourceURI
Field sourceURI
-
nodeFilters
private java.util.List<NodeFilter> nodeFilters
Node Filter list.
-
needsToBeExpanded
private boolean needsToBeExpanded
-
outputStream
private java.io.OutputStream outputStream
-
preCalculatedDigest
private java.lang.String preCalculatedDigest
Pre-calculated digest value of the object in base64.
-
-
Constructor Detail
-
XMLSignatureInput
public XMLSignatureInput(byte[] inputOctets)
Construct a XMLSignatureInput from an octet array.This is a comfort method, which internally converts the byte[] array into an InputStream
NOTE: no defensive copy
- Parameters:
inputOctets- an octet array which including XML document or node
-
XMLSignatureInput
public XMLSignatureInput(java.io.InputStream inputOctetStream)
Constructs aXMLSignatureInputfrom an octet stream. The stream is directly read.- Parameters:
inputOctetStream-
-
XMLSignatureInput
public XMLSignatureInput(org.w3c.dom.Node rootNode)
Construct a XMLSignatureInput from a subtree rooted by rootNode. This method included the node and all his descendants in the output.- Parameters:
rootNode-
-
XMLSignatureInput
public XMLSignatureInput(java.util.Set<org.w3c.dom.Node> inputNodeSet)
Constructor XMLSignatureInput- Parameters:
inputNodeSet-
-
XMLSignatureInput
public XMLSignatureInput(java.lang.String preCalculatedDigest)
Construct aXMLSignatureInputfrom a known digest value in Base64. This makes it possible to compare the element digest with the provided digest value.- Parameters:
preCalculatedDigest- digest value in base64.
-
-
Method Detail
-
isNeedsToBeExpanded
public boolean isNeedsToBeExpanded()
Check if the structure needs to be expanded.- Returns:
- true if so.
-
setNeedsToBeExpanded
public void setNeedsToBeExpanded(boolean needsToBeExpanded)
Set if the structure needs to be expanded.- Parameters:
needsToBeExpanded- true if so.
-
getNodeSet
public java.util.Set<org.w3c.dom.Node> getNodeSet() throws CanonicalizationException, javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXExceptionReturns the node set from input which was specified as the parameter ofXMLSignatureInputconstructor- Returns:
- the node set
- Throws:
org.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionCanonicalizationException
-
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(boolean circumvent) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException, CanonicalizationExceptionReturns the node set from input which was specified as the parameter ofXMLSignatureInputconstructor- Parameters:
circumvent-- Returns:
- the node set
- Throws:
org.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionCanonicalizationException
-
getOctetStream
public java.io.InputStream getOctetStream() throws java.io.IOExceptionReturns the Octet stream(byte Stream) from input which was specified as the parameter ofXMLSignatureInputconstructor- Returns:
- the Octet stream(byte Stream) from input which was specified as
the parameter of
XMLSignatureInputconstructor - Throws:
java.io.IOException
-
getOctetStreamReal
public java.io.InputStream getOctetStreamReal()
- Returns:
- real octet stream
-
getBytes
public byte[] getBytes() throws java.io.IOException, CanonicalizationExceptionReturns the byte array from input which was specified as the parameter ofXMLSignatureInputconstructor- Returns:
- the byte[] from input which was specified as the parameter of
XMLSignatureInputconstructor - Throws:
CanonicalizationExceptionjava.io.IOException
-
isNodeSet
public boolean isNodeSet()
Determines if the object has been set up with a Node set- Returns:
- true if the object has been set up with a Node set
-
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
-
isOctetStream
public boolean isOctetStream()
Determines if the object has been set up with an octet stream- Returns:
- true if the object has been set up with an octet stream
-
isOutputStreamSet
public boolean isOutputStreamSet()
Determines ifsetOutputStream(java.io.OutputStream)has been called with a non-null OutputStream.- Returns:
- true if
setOutputStream(java.io.OutputStream)has been called with a non-null OutputStream
-
isByteArray
public boolean isByteArray()
Determines if the object has been set up with a ByteArray- Returns:
- true is the object has been set up with an octet stream
-
isPreCalculatedDigest
public boolean isPreCalculatedDigest()
Determines if the object has been set up with a pre-calculated digest.- Returns:
-
isInitialized
public boolean isInitialized()
Is the object correctly set up?- Returns:
- true if the object has been set up correctly
-
getMIMEType
public java.lang.String getMIMEType()
Returns mimeType- Returns:
- mimeType
-
setMIMEType
public void setMIMEType(java.lang.String mimeType)
Sets mimeType- Parameters:
mimeType-
-
getSourceURI
public java.lang.String getSourceURI()
Return SourceURI- Returns:
- SourceURI
-
setSourceURI
public void setSourceURI(java.lang.String sourceURI)
Sets SourceURI- Parameters:
sourceURI-
-
toString
public java.lang.String toString()
Method toString- Overrides:
toStringin classjava.lang.Object
-
getHTMLRepresentation
public java.lang.String getHTMLRepresentation() throws XMLSignatureExceptionMethod getHTMLRepresentation- Returns:
- The HTML representation for this XMLSignature
- Throws:
XMLSignatureException
-
getHTMLRepresentation
public java.lang.String getHTMLRepresentation(java.util.Set<java.lang.String> inclusiveNamespaces) throws XMLSignatureExceptionMethod getHTMLRepresentation- Parameters:
inclusiveNamespaces-- Returns:
- The HTML representation for this XMLSignature
- Throws:
XMLSignatureException
-
getExcludeNode
public org.w3c.dom.Node getExcludeNode()
Gets the exclude node of this XMLSignatureInput- Returns:
- Returns the excludeNode.
-
setExcludeNode
public void setExcludeNode(org.w3c.dom.Node excludeNode)
Sets the exclude node of this XMLSignatureInput- Parameters:
excludeNode- The excludeNode to set.
-
getSubNode
public org.w3c.dom.Node getSubNode()
Gets the node of this XMLSignatureInput- Returns:
- The excludeNode set.
-
isExcludeComments
public boolean isExcludeComments()
- Returns:
- Returns the excludeComments.
-
setExcludeComments
public void setExcludeComments(boolean excludeComments)
- Parameters:
excludeComments- The excludeComments to set.
-
updateOutputStream
public void updateOutputStream(java.io.OutputStream diOs) throws CanonicalizationException, java.io.IOException- Parameters:
diOs-- Throws:
java.io.IOExceptionCanonicalizationException
-
updateOutputStream
public void updateOutputStream(java.io.OutputStream diOs, boolean c14n11) throws CanonicalizationException, java.io.IOException- Throws:
CanonicalizationExceptionjava.io.IOException
-
setOutputStream
public void setOutputStream(java.io.OutputStream os)
- Parameters:
os-
-
getBytesFromInputStream
private byte[] getBytesFromInputStream() throws java.io.IOException- Throws:
java.io.IOException
-
addNodeFilter
public void addNodeFilter(NodeFilter filter)
- Parameters:
filter-
-
getNodeFilters
public java.util.List<NodeFilter> getNodeFilters()
- Returns:
- the node filters
-
setNodeSet
public void setNodeSet(boolean b)
- Parameters:
b-
-
convertToNodes
void convertToNodes() throws CanonicalizationException, javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException- Throws:
CanonicalizationExceptionjavax.xml.parsers.ParserConfigurationExceptionjava.io.IOExceptionorg.xml.sax.SAXException
-
isSecureValidation
public boolean isSecureValidation()
-
setSecureValidation
public void setSecureValidation(boolean secureValidation)
-
getPreCalculatedDigest
public java.lang.String getPreCalculatedDigest()
-
-