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
  • Field Details

    • inputNodeSet

      private Set<Node> inputNodeSet
      The original set from the constructor.
    • subNode

      private Node subNode
      The original Element
    • isNodeSet

      private boolean isNodeSet
    • nodeFilters

      private final List<NodeFilter> nodeFilters
      Node Filter list.
    • excludeNode

      private Node excludeNode
      Exclude Node *for enveloped transformations
    • excludeComments

      private boolean excludeComments
    • sourceURI

      private String sourceURI
    • mimeType

      private String mimeType
    • needsToBeExpanded

      private boolean needsToBeExpanded
    • secureValidation

      private boolean secureValidation
    • outputStream

      private OutputStream outputStream
  • Constructor Details

    • 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 -
    • XMLSignatureInput

      protected XMLSignatureInput(Set<Node> nodeSet)
      Construct a XMLSignatureInput from a Set of Nodes.
      Parameters:
      nodeSet -
  • Method Details

    • 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 InputStream from input which was specified as the parameter of XMLSignatureInput constructor
      Throws:
      IOException
    • convertToNode

      protected abstract Node convertToNode() throws XMLParserException, IOException
      Returns:
      data given in constructor converted to a Node or null if such conversion is not supported by this XMLSignatureInput
      Throws:
      XMLParserException
      IOException
    • write

      public void write(OutputStream output) throws CanonicalizationException, IOException
      Writes the data to the output stream.
      Parameters:
      output -
      Throws:
      CanonicalizationException
      IOException
    • write

      public abstract void write(OutputStream output, boolean c14n11) throws CanonicalizationException, IOException
      Writes the data to the output stream.
      Parameters:
      output -
      c14n11 -
      Throws:
      CanonicalizationException
      IOException
      See Also:
    • getInputNodeSet

      public Set<Node> getInputNodeSet()
      Get the Input NodeSet.
      Returns:
      the Input NodeSet.
    • getNodeSet

      public Set<Node> getNodeSet() throws XMLParserException, IOException
      Returns the node set from input which was specified as the parameter of XMLSignatureInput constructor

      Can call the convertToNode() to parse the Node from the input data. The internal state will change then.

      Returns:
      the node set
      Throws:
      XMLParserException
      IOException
    • getNodeSet

      private Set<Node> getNodeSet(boolean circumvent) throws XMLParserException, IOException
      Returns the node set from input which was specified as the parameter of XMLSignatureInput constructor

      Can call the convertToNode() to parse the Node from the input data. The internal state will change then.

      Parameters:
      circumvent -
      Returns:
      the node set
      Throws:
      XMLParserException
      IOException
    • getSubNode

      public Node getSubNode()
      Gets the node of this XMLSignatureInput
      Returns:
      The excludeNode set.
    • addNodeFilter

      public void addNodeFilter(NodeFilter filter) throws XMLParserException, IOException
      Parameters:
      filter -
      Throws:
      XMLParserException
      IOException
    • 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, CanonicalizationException
      Returns the byte array from input which was specified as the parameter of XMLSignatureInput constructor OR tries to reconstruct that if the element or node was already processed.
      Returns:
      the byte array
      Throws:
      CanonicalizationException
      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 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 in write(OutputStream) method
    • getOutputStream

      public OutputStream getOutputStream()
      Returns:
      OutputStream set in setOutputStream(OutputStream)
    • toString

      public String toString()
      Creates a short description of this instance.
      Overrides:
      toString in class Object
    • canonicalize

      protected void canonicalize(OutputStream output, boolean c14n11) throws CanonicalizationException, IOException
      Canonicalizes this object to the output stream.
      Parameters:
      c14n11 -
      output -
      Throws:
      CanonicalizationException
      IOException