Class SignedDocumentValidator

    • Field Detail

      • processExecutor

        protected SignatureProcessExecutor processExecutor
        This variable can hold a specific SignatureProcessExecutor
      • validationCertPool

        protected CertificatePool validationCertPool
        This is the pool of certificates used in the validation process. The pools present in the certificate verifier are merged and added to this pool.
      • document

        protected DSSDocument document
        The document to be validated (with the signature(s))
      • detachedContents

        protected List<DSSDocument> detachedContents
        In case of a detached signature this List contains the signed documents.
      • containerContents

        protected List<DSSDocument> containerContents
        In case of an ASiC signature this List of container documents.
      • providedSigningCertificateToken

        protected CertificateToken providedSigningCertificateToken
      • certificateVerifier

        protected CertificateVerifier certificateVerifier
        The reference to the certificate verifier. The current DSS implementation proposes CommonCertificateVerifier. This verifier encapsulates the references to different sources used in the signature validation process.
    • Constructor Detail

      • SignedDocumentValidator

        protected SignedDocumentValidator​(SignatureScopeFinder signatureScopeFinder)
    • Method Detail

      • fromDocument

        public static SignedDocumentValidator fromDocument​(DSSDocument dssDocument)
        This method guesses the document format and returns an appropriate document validator.
        Parameters:
        dssDocument - The instance of DSSDocument to validate
        Returns:
        returns the specific instance of SignedDocumentValidator in terms of the document type
      • isSupported

        public abstract boolean isSupported​(DSSDocument dssDocument)
      • setCertificateVerifier

        public void setCertificateVerifier​(CertificateVerifier certificateVerifier)
        To carry out the validation process of the signature(s) some external sources of certificates and of revocation data can be needed. The certificate verifier is used to pass these values. Note that once this setter is called any change in the content of the CommonTrustedCertificateSource or in adjunct certificate source is not taken into account.
        Specified by:
        setCertificateVerifier in interface DocumentValidator
        Parameters:
        certificateVerifier -
      • setDetachedContents

        public void setDetachedContents​(List<DSSDocument> detachedContents)
        Description copied from interface: DocumentValidator
        Sets the List of DSSDocument containing the original contents to sign, for detached signature scenarios.
        Specified by:
        setDetachedContents in interface DocumentValidator
        Parameters:
        detachedContents - the List of DSSDocument to set
      • setContainerContents

        public void setContainerContents​(List<DSSDocument> containerContents)
        Description copied from interface: DocumentValidator
        Sets the List of DSSDocument containing the original container content for ASiC signatures.
        Specified by:
        setContainerContents in interface DocumentValidator
        Parameters:
        containerContents - the List of DSSDocument to set
      • setEnableEtsiValidationReport

        public void setEnableEtsiValidationReport​(boolean enableEtsiValidationReport)
        Description copied from interface: DocumentValidator
        This method allows to specify if the ETSI Validation Report must be generated. By default the value if TRUE (the ETSI Validation report will be generated).
        Specified by:
        setEnableEtsiValidationReport in interface DocumentValidator
        Parameters:
        enableEtsiValidationReport - - TRUE if the report must be generated, FALSE otherwise
      • validateDocument

        public Reports validateDocument()
        Description copied from interface: DocumentValidator
        Validates the document and all its signatures. The default constraint file is used.
        Specified by:
        validateDocument in interface DocumentValidator
        Returns:
        Reports: diagnostic data, detailed report and simple report
      • validateDocument

        public Reports validateDocument​(URL validationPolicyURL)
        Description copied from interface: DocumentValidator
        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 or empty the default file is used.
        Specified by:
        validateDocument in interface DocumentValidator
        Returns:
        Reports: diagnostic data, detailed report and simple report
      • validateDocument

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

        public Reports validateDocument​(File policyFile)
        Description copied from interface: DocumentValidator
        Validates the document and all its signatures. The File parameter specifies the constraint file. If null or empty the default file is used.
        Specified by:
        validateDocument in interface DocumentValidator
        Parameters:
        policyFile - contains the validation policy (xml) as File
        Returns:
        Reports: diagnostic data, detailed report and simple report
      • validateDocument

        public Reports validateDocument​(InputStream policyDataStream)
        Validates the document and all its signatures. The policyDataStream contains the constraint file. If null or empty the default file is used.
        Specified by:
        validateDocument in interface DocumentValidator
        Parameters:
        policyDataStream - the InputStream with the validation policy
        Returns:
        the validation reports
      • validateDocument

        public Reports validateDocument​(ConstraintsParameters validationPolicyJaxb)
        Validates the document and all its signatures. The validationPolicyDom contains the constraint file. If null or empty the default file is used.
        Specified by:
        validateDocument in interface DocumentValidator
        Parameters:
        validationPolicyJaxb - the ConstraintsParameters to use in the validation process
        Returns:
        the validation reports
      • validateDocument

        public Reports validateDocument​(ValidationPolicy validationPolicy)
        Validates the document and all its signatures. The validationPolicyDom contains the constraint file. If null or empty the default file is used.
        Specified by:
        validateDocument in interface DocumentValidator
        Parameters:
        validationPolicy - the ValidationPolicy to use in the validation process
        Returns:
        the validation reports
      • getContainerInfo

        protected ContainerInfo getContainerInfo()
        This method allows to retrieve the container information (ASiC Container)
        Returns:
        the container information
      • ensureSignaturePolicyDetectorInitialized

        protected void ensureSignaturePolicyDetectorInitialized()
      • provideProcessExecutorInstance

        public SignatureProcessExecutor provideProcessExecutorInstance()
        This method returns the process executor. If the instance of this class is not yet instantiated then the new instance is created.
        Returns:
        SignatureProcessExecutor