Class SignatureValidationContext

  • All Implemented Interfaces:
    ValidationContext

    public class SignatureValidationContext
    extends Object
    implements ValidationContext
    During the validation of a signature, the software retrieves different X509 artifacts like Certificate, CRL and OCSP Response. The SignatureValidationContext is a "cache" for one validation request that contains every object retrieved so far.
    • Field Detail

      • validationCertificatePool

        protected CertificatePool validationCertificatePool
        The certificate pool which encapsulates all certificates used during the validation process and extracted from all used sources
      • currentTime

        protected Date currentTime
        This is the time at what the validation is carried out. It is used only for test purpose.
    • Constructor Detail

      • SignatureValidationContext

        public SignatureValidationContext()
        This constructor is used during the signature creation process. The certificate pool is created within initialize method.
      • SignatureValidationContext

        public SignatureValidationContext​(CertificatePool validationCertificatePool)
        This constructor is used when a signature need to be validated.
        Parameters:
        validationCertificatePool - The pool of certificates used during the validation process
    • Method Detail

      • initialize

        public void initialize​(CertificateVerifier certificateVerifier)
        Specified by:
        initialize in interface ValidationContext
        Parameters:
        certificateVerifier - The certificates verifier (eg: using the TSL as list of trusted certificates).
      • setCurrentTime

        public void setCurrentTime​(Date currentTime)
        Description copied from interface: ValidationContext
        This function sets the validation time.
        Specified by:
        setCurrentTime in interface ValidationContext
        Parameters:
        currentTime - the current Date
      • addRevocationTokensForVerification

        public void addRevocationTokensForVerification​(List<RevocationToken> revocationTokens)
        Description copied from interface: ValidationContext
        Adds a list of new revocation tokens to the list of tokens to verify. If the revocation token has already been added then it is ignored.
        Specified by:
        addRevocationTokensForVerification in interface ValidationContext
        Parameters:
        revocationTokens - a list of RevocationToken revocation tokens to verify
      • addCertificateTokenForVerification

        public void addCertificateTokenForVerification​(CertificateToken certificateToken)
        Description copied from interface: ValidationContext
        Adds a new certificate token to the list of tokens to verify. If the certificate token has already been added then it is ignored.
        Specified by:
        addCertificateTokenForVerification in interface ValidationContext
        Parameters:
        certificateToken - CertificateToken certificate token to verify
      • addTimestampTokenForVerification

        public void addTimestampTokenForVerification​(TimestampToken timestampToken)
        Description copied from interface: ValidationContext
        Adds a new timestamp token to the list of tokens to verify. If the timestamp token has already been added then it is ignored.
        Specified by:
        addTimestampTokenForVerification in interface ValidationContext
        Parameters:
        timestampToken - TimestampToken timestamp token to verify
      • isAllRequiredRevocationDataPresent

        public boolean isAllRequiredRevocationDataPresent()
        Description copied from interface: ValidationContext
        This method allows to verify if all processed certificates have a revocation data
        Specified by:
        isAllRequiredRevocationDataPresent in interface ValidationContext
        Returns:
        true if at least one revocation data is present for each certificate
      • isAllPOECoveredByRevocationData

        public boolean isAllPOECoveredByRevocationData()
        Description copied from interface: ValidationContext
        This method allows to verify if all POE (timestamp tokens) are covered by a revocation data
        Specified by:
        isAllPOECoveredByRevocationData in interface ValidationContext
        Returns:
        true if all POE have at least one revocation data issued after the POE creation
      • isAllTimestampValid

        public boolean isAllTimestampValid()
        Description copied from interface: ValidationContext
        This method allows to verify if all processed timestamps are valid and intact
        Specified by:
        isAllTimestampValid in interface ValidationContext
        Returns:
        true if all processed timestamps are valid
      • isAllCertificateValid

        public boolean isAllCertificateValid()
        Description copied from interface: ValidationContext
        This method allows to verify if all processed certificates are not revoked
        Specified by:
        isAllCertificateValid in interface ValidationContext
        Returns:
        true if all processed certificates are still valid
      • isAtLeastOneRevocationDataPresentAfterBestSignatureTime

        public boolean isAtLeastOneRevocationDataPresentAfterBestSignatureTime​(CertificateToken signingCertificate)
        Description copied from interface: ValidationContext
        This method allows to verify if there is at least one revocation data present after the earliest available timestamp token producing time
        Specified by:
        isAtLeastOneRevocationDataPresentAfterBestSignatureTime in interface ValidationContext
        Parameters:
        signingCertificate - CertificateToken signing certificate of the signature to be checked
        Returns:
        true if there is at least one revocation data issued after the earliest timestamp time
      • getProcessedCertificates

        public Set<CertificateToken> getProcessedCertificates()
        Description copied from interface: ValidationContext
        Returns a read only list of all certificates used in the process of the validation of all signatures from the given document. This list includes the certificate to check, certification chain certificates, OCSP response certificate...
        Specified by:
        getProcessedCertificates in interface ValidationContext
        Returns:
        The list of CertificateToken(s)