Interface DocumentValidator

All Superinterfaces:
ProcessExecutorProvider<DocumentProcessExecutor>
All Known Subinterfaces:
EvidenceRecordValidator
All Known Implementing Classes:
AbstractASiCContainerValidator, AbstractJWSDocumentValidator, ASiCContainerWithCAdESValidator, ASiCContainerWithXAdESValidator, ASiCWithCAdESTimestampValidator, ASN1EvidenceRecordValidator, CMSDocumentValidator, DefaultEvidenceRecordValidator, DetachedTimestampValidator, JWSCompactDocumentValidator, JWSSerializationDocumentValidator, PDFADocumentValidator, PDFDocumentValidator, SignedDocumentValidator, XMLDocumentValidator, XMLEvidenceRecordValidator

public interface DocumentValidator extends ProcessExecutorProvider<DocumentProcessExecutor>
This is the interface to be used when implementing different signature validators.
  • Method Details

    • getSignatures

      List<AdvancedSignature> getSignatures()
      Retrieves the signatures found in the document
      Returns:
      a list of AdvancedSignatures for validation purposes
    • getDetachedTimestamps

      List<TimestampToken> getDetachedTimestamps()
      Retrieves the detached timestamps found in the document
      Returns:
      a list of TimestampToken for validation purposes
    • getDetachedEvidenceRecords

      List<EvidenceRecord> getDetachedEvidenceRecords()
      Retrieves the detached evidence records found in the document
      Returns:
      a list of Evidence Records for validation purposes
    • setCertificateVerifier

      void setCertificateVerifier(CertificateVerifier certificateVerifier)
      Provides a CertificateVerifier to be used during the validation process.
      Parameters:
      certificateVerifier - CertificateVerifier
    • setValidationContextExecutor

      void setValidationContextExecutor(ValidationContextExecutor validationContextExecutor)
      This method sets ValidationContextExecutor for validation of the prepared ValidationContext Default: eu.europa.esig.dss.validation.executor.context.DefaultValidationContextExecutor (performs basic validation of tokens, including certificate chain building and revocation data extraction, without processing of validity checks)
      Parameters:
      validationContextExecutor - ValidationContextExecutor
    • setDefaultDigestAlgorithm

      void setDefaultDigestAlgorithm(DigestAlgorithm digestAlgorithm)
      This method allows to change the Digest Algorithm that will be used for tokens' digest calculation Default : DigestAlgorithm.SHA256
      Parameters:
      digestAlgorithm - DigestAlgorithm to use
    • setTokenExtractionStrategy

      void setTokenExtractionStrategy(TokenExtractionStrategy tokenExtractionStrategy)
      This method allows to set the token extraction strategy to follow in the diagnostic data generation.
      Parameters:
      tokenExtractionStrategy - the TokenExtractionStrategy
    • setTokenIdentifierProvider

      void setTokenIdentifierProvider(TokenIdentifierProvider tokenIdentifierProvider)
      Sets the TokenIdentifierProvider
      Parameters:
      tokenIdentifierProvider - TokenIdentifierProvider
    • setIncludeSemantics

      void setIncludeSemantics(boolean include)
      This method allows to enable/disable the semantics inclusion in the reports (Indication / SubIndication meanings) Disabled by default
      Parameters:
      include - true to enable the inclusion of the semantics
    • setValidationTime

      void setValidationTime(Date validationTime)
      Allows to define a custom validation time
      Parameters:
      validationTime - Date
    • setDetachedContents

      void setDetachedContents(List<DSSDocument> detachedContent)
      Sets the List of DSSDocument containing the original contents to sign, for detached signature scenarios.
      Parameters:
      detachedContent - the List of DSSDocument to set
    • setDetachedEvidenceRecordDocuments

      void setDetachedEvidenceRecordDocuments(List<DSSDocument> detachedEvidenceRecordDocuments)
      Sets a List of DSSDocument containing the evidence record documents covering the signature document.
      Parameters:
      detachedEvidenceRecordDocuments - the List of DSSDocument to set
    • setContainerContents

      void setContainerContents(List<DSSDocument> archiveContents)
      Sets the List of DSSDocument containing the original container content for ASiC-S signatures.
      Parameters:
      archiveContents - the List of DSSDocument to set
    • setManifestFile

      void setManifestFile(ManifestFile manifestFile)
      Sets a related ManifestFile to the document to be validated.
      Parameters:
      manifestFile - a ManifestFile to set
    • setSigningCertificateSource

      void setSigningCertificateSource(CertificateSource certificateSource)
      Set a certificate source which allows to find the signing certificate by kid or certificate's digest
      Parameters:
      certificateSource - the certificate source
    • setValidationLevel

      void setValidationLevel(ValidationLevel validationLevel)
      This method allows to specify the validation level (Basic / Timestamp / Long Term / Archival). By default, the selected validation is ARCHIVAL
      Parameters:
      validationLevel - ValidationLevel
    • setEnableEtsiValidationReport

      void setEnableEtsiValidationReport(boolean enableEtsiValidationReport)
      This method allows to specify if the ETSI Validation Report must be generated. Default : TRUE (the ETSI Validation report will be generated).
      Parameters:
      enableEtsiValidationReport - - TRUE if the report must be generated, FALSE otherwise
    • setSignaturePolicyProvider

      void setSignaturePolicyProvider(SignaturePolicyProvider signaturePolicyProvider)
      This method allows to set a provider for Signature policies
      Parameters:
      signaturePolicyProvider - SignaturePolicyProvider
    • validateDocument

      Reports validateDocument()
      Validates the document and all its signatures. The default constraint file is used.
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(URL validationPolicyURL)
      Validates the document and all its signatures. If the validation policy URL is set then the policy constraints are retrieved from this location. If null the default file is used.
      Parameters:
      validationPolicyURL - URL
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(String policyResourcePath)
      Validates the document and all its signatures. The policyResourcePath specifies the constraint file. If null or empty the default file is used.
      Parameters:
      policyResourcePath - is located against the classpath (getClass().getResourceAsStream), and NOT the filesystem
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(File policyFile)
      Validates the document and all its signatures. The File parameter specifies the constraint file. If null or file does not exist the default file is used.
      Parameters:
      policyFile - contains the validation policy (xml) as File
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(DSSDocument policyDocument)
      Validates the document and all its signatures. The policyDataStream contains the constraint file. If null the default file is used.
      Parameters:
      policyDocument - contains the validation policy (xml) as DSSDocument
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(InputStream policyDataStream)
      Validates the document and all its signatures. The policyDataStream contains the constraint file. If null the default file is used.
      Parameters:
      policyDataStream - contains the validation policy (xml) as InputStream
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(ValidationPolicy validationPolicy)
      Validates the document and all its signatures. The validationPolicy contains the constraint file. Please see eu.europa.esig.dss.validation.policy.ValidationPolicyLoader for building a customizable validation policy. If null or empty the default file is used.
      Parameters:
      validationPolicy - ValidationPolicy
      Returns:
      Reports
    • validateDocument

      Reports validateDocument(URL validationPolicyURL, URL cryptographicSuiteURL)
      Validates the document and all its signatures, using the provided validation policy. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please use eu.europa.esig.dss.validation.policy.ValidationPolicyLoader.

      The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.

      If the validation policy URL is set then the policy constraints are retrieved from this location. If null or empty the default file is used.

      Parameters:
      validationPolicyURL - URL to the used validation policy file
      cryptographicSuiteURL - URL to the used cryptographic suite file
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(String policyResourcePath, String cryptographicSuitePath)
      Validates the document and all its signatures, using the provided validation policy. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please use eu.europa.esig.dss.validation.policy.ValidationPolicyLoader.

      The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.

      The policyResourcePath and cryptographicSuitePath specify the constraint file. If null or empty the default file is used.

      Parameters:
      policyResourcePath - String path to the validation policy file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystem
      cryptographicSuitePath - String path to the cryptographic suite file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystem
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(File policyFile, File cryptographicSuiteFile)
      Validates the document and all its signatures, using the provided validation policy. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please use eu.europa.esig.dss.validation.policy.ValidationPolicyLoader.

      The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.

      The File parameters specify the constraint file. If null the default file is used.

      Parameters:
      policyFile - File containing the validation policy
      cryptographicSuiteFile - File containing the cryptographic suite
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(DSSDocument policyDocument, DSSDocument cryptographicSuiteDocument)
      Validates the document and all its signatures, using the provided validation policy. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please use eu.europa.esig.dss.validation.policy.ValidationPolicyLoader.

      The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.

      The DSSDocument parameters contains the constraint files. If null the default file is used.

      Parameters:
      policyDocument - DSSDocument containing the validation policy
      cryptographicSuiteDocument - DSSDocument containing the cryptographic suite
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • validateDocument

      Reports validateDocument(InputStream policyDataStream, InputStream cryptographicSuiteStream)
      Validates the document and all its signatures, using the provided validation policy. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please use eu.europa.esig.dss.validation.policy.ValidationPolicyLoader.

      The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.

      The InputStream parameters contains the constraint files. If null the default file is used.

      Parameters:
      policyDataStream - InputStream containing the validation policy
      cryptographicSuiteStream - InputStream containing the cryptographic suite
      Returns:
      Reports: diagnostic data, detailed report and simple report
    • getOriginalDocuments

      List<DSSDocument> getOriginalDocuments(String signatureId)
      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

      List<DSSDocument> getOriginalDocuments(AdvancedSignature advancedSignature)
      This method returns the signed document(s) without their signature(s)
      Parameters:
      advancedSignature - AdvancedSignature to find signer documents for
      Returns:
      list of DSSDocuments
    • getValidationData

      <T extends AdvancedSignature> ValidationDataContainer getValidationData(Collection<T> signatures)
      Extracts a validation data for provided collection of signatures
      Type Parameters:
      T - AdvancedSignature implementation
      Parameters:
      signatures - a collection of AdvancedSignatures
      Returns:
      ValidationDataContainer
    • getValidationData

      <T extends AdvancedSignature> ValidationDataContainer getValidationData(Collection<T> signatures, Collection<TimestampToken> detachedTimestamps)
      Extracts a validation data for provided collection of signatures and/or timestamps
      Type Parameters:
      T - AdvancedSignature implementation
      Parameters:
      signatures - a collection of AdvancedSignatures
      detachedTimestamps - a collection of detached TimestampTokens
      Returns:
      ValidationDataContainer