Class XMLDocumentValidator

java.lang.Object
eu.europa.esig.dss.validation.SignedDocumentValidator
eu.europa.esig.dss.xades.validation.XMLDocumentValidator
All Implemented Interfaces:
DocumentValidator, ProcessExecutorProvider<DocumentProcessExecutor>

public class XMLDocumentValidator
extends SignedDocumentValidator
Validator of XML Signed document
  • Field Details

    • xadesPathsHolders

      protected List<XAdESPaths> xadesPathsHolders
      This variable contains the list of XAdESPaths adapted to the specific signature schema.
    • rootElement

      protected Document rootElement
      The root element of the document to validate
  • Constructor Details

    • XMLDocumentValidator

      public XMLDocumentValidator​(DSSDocument dssDocument)
      The default constructor for XMLDocumentValidator. The created instance is initialised with default XAdESPaths .
      Parameters:
      dssDocument - The instance of DSSDocument to validate
  • Method Details

    • isSupported

      public boolean isSupported​(DSSDocument dssDocument)
      Description copied from class: SignedDocumentValidator
      Checks if the document is supported by the current validator
      Specified by:
      isSupported in class SignedDocumentValidator
      Parameters:
      dssDocument - DSSDocument to check
      Returns:
      TRUE if the document is supported, FALSE otherwise
    • setDisableXSWProtection

      public void setDisableXSWProtection​(boolean disableXSWProtection)
      NOT RECOMMENDED : This parameter allows to disable protection against XML Signature wrapping attacks (XSW). It disables the research by XPath expression for defined Type attributes.
      Parameters:
      disableXSWProtection - true to disable the protection
    • getSignatures

      public List<AdvancedSignature> getSignatures()
      Description copied from interface: DocumentValidator
      Retrieves the signatures found in the document
      Specified by:
      getSignatures in interface DocumentValidator
      Overrides:
      getSignatures in class SignedDocumentValidator
      Returns:
      a list of AdvancedSignatures for validation purposes
    • getSignatureById

      public AdvancedSignature getSignatureById​(String signatureId) throws DSSException
      Retrieves a signature based on its Id
      Parameters:
      signatureId - the given Id
      Returns:
      the corresponding XAdESSignature
      Throws:
      DSSException - in case no Id is provided, or in case no signature was found for the given Id
    • getOriginalDocuments

      public List<DSSDocument> getOriginalDocuments​(String signatureId)
      Description copied from interface: DocumentValidator
      This method returns the signed document(s) without their signature(s)
      Parameters:
      signatureId - the DSS ID of the signature to extract original signer data for
      Returns:
      list of DSSDocuments
    • getOriginalDocuments

      public List<DSSDocument> getOriginalDocuments​(AdvancedSignature advancedSignature)
      Description copied from interface: DocumentValidator
      This method returns the signed document(s) without their signature(s)
      Parameters:
      advancedSignature - AdvancedSignature to find signer documents for
      Returns:
      list of DSSDocuments
    • getXAdESPathsHolder

      public List<XAdESPaths> getXAdESPathsHolder()
      This getter returns the XAdESPaths
      Returns:
      a list of XAdESPaths
    • addXAdESPathsHolder

      public void addXAdESPathsHolder​(XAdESPaths xadesPathsHolder)
      This adds a XAdESPaths. This is useful when the signature follows a particular schema.
      Parameters:
      xadesPathsHolder - XAdESPaths
    • clearQueryHolders

      public void clearQueryHolders()
      Removes all of the elements from the list of query holders. The list will be empty after this call returns.
    • getRootElement

      public Document getRootElement()
      Returns the root element of the validating document
      Returns:
      Document