Class ATSLValidator

  • All Implemented Interfaces:
    ITSLValidator
    Direct Known Subclasses:
    TSLValidator

    public abstract class ATSLValidator
    extends java.lang.Object
    implements ITSLValidator

    Abstract class that represents a TSL validator with the principal functions regardless it implementation.

    Project:

    Library for the integration with the services of @Firma, eVisor and TS@.

    Version:
    1.6, 19/09/2022.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TSP_SERVICE_NAME_FOR_DIST_POINT
      Constant attribute that represents a token for a TSP Service Name when the validation has been executed using the Distribution Point of the certificate to validate.
    • Constructor Summary

      Constructors 
      Constructor Description
      ATSLValidator()
      Constructor method for the class ATSLValidator.java.
    • Field Detail

      • TSP_SERVICE_NAME_FOR_DIST_POINT

        public static final java.lang.String TSP_SERVICE_NAME_FOR_DIST_POINT
        Constant attribute that represents a token for a TSP Service Name when the validation has been executed using the Distribution Point of the certificate to validate.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ATSLValidator

        public ATSLValidator()
        Constructor method for the class ATSLValidator.java.
    • Method Detail

      • validateCertificateWithTSL

        public ITSLValidatorResult validateCertificateWithTSL​(java.security.cert.X509Certificate cert,
                                                              boolean isCACert,
                                                              boolean isTsaCertificate,
                                                              java.util.Date validationDate,
                                                              boolean checkStatusRevocation)
                                                       throws TSLArgumentException,
                                                              TSLValidationException
        Validate the status of the input certificate with the information of the TSL.
        Specified by:
        validateCertificateWithTSL in interface ITSLValidator
        Parameters:
        cert - Certificate X509 v3 to validate.
        isCACert - Flag that indicates if the input certificate has the Basic Constraints with the CA flag activated (true) or not (false).
        isTsaCertificate - Flag that indicates if the input certificate has the id-kp-timestamping key purpose (true) or not (false).
        validationDate - Validation date to check the certificate status revocation.
        checkStatusRevocation - Flag that indicates if only try to detect the input certificate (false) or also checks the revocation status of this (true).
        Returns:
        validation result object representation.
        Throws:
        TSLArgumentException - In case of the input certificate was null.
        TSLValidationException - In case of some error validating the certificate with the TSL.
        See Also:
        ITSLValidator.validateCertificateWithTSL(X509Certificate, boolean, boolean, Date, boolean)
      • checkIfTSPServiceStatusIsOK

        public abstract boolean checkIfTSPServiceStatusIsOK​(java.lang.String serviceStatus)
        Checks if the input service status URI defines an OK status.
        Parameters:
        serviceStatus - Service Status URI string to check.
        Returns:
        true if represents an OK status, otherwise false.
      • checkIfTSPServiceTypeIsCAQC

        public abstract boolean checkIfTSPServiceTypeIsCAQC​(java.lang.String tspServiceType)
        Checks if the input TSP Service Type is CA QC.
        Parameters:
        tspServiceType - TSP Service type URI to check.
        Returns:
        true if it represents a CA QC TSP Service, otherwise false.
      • checkIfTSPServiceTypeIsCAPKC

        public abstract boolean checkIfTSPServiceTypeIsCAPKC​(java.lang.String tspServiceType)
        Checks if the input TSP Service Type is CA PKC.
        Parameters:
        tspServiceType - TSP Service type URI to check.
        Returns:
        true if it represents a CA PKC TSP Service, otherwise false.
      • checkIfTSPServiceTypeIsCRLCompatible

        public abstract boolean checkIfTSPServiceTypeIsCRLCompatible​(ServiceHistoryInstance shi,
                                                                     boolean isCertQualified)
        Checks if the service type is a CRL compatible type. It will be compatible when the certificate was qualified, and this service was for qualified certificates, or the certificate is not qualified, and the service is for not qualified.
        Parameters:
        shi - TSP Service History Information to analyze.
        isCertQualified - Flag that indicates if the certificate is qualified (true) or not (false).
        Returns:
        true if the Service type is CRL compatible with the certificate to validate. otherwise false.
      • checkIfTSPServiceTypeIsOCSPCompatible

        public abstract boolean checkIfTSPServiceTypeIsOCSPCompatible​(ServiceHistoryInstance shi,
                                                                      boolean isCertQualified)
        Checks if the service type is a OCSP compatible type. It will be compatible when the certificate was qualified, and this service was for qualified certificates, or the certificate is not qualified, and the service is for not qualified.
        Parameters:
        shi - TSP Service History Information to analyze.
        isCertQualified - Flag that indicates if the certificate is qualified (true) or not (false).
        Returns:
        true if the Service type is OCSP compatible with the certificate to validate. otherwise false.
      • getCertificateFromHTTPURI

        public java.security.cert.X509Certificate getCertificateFromHTTPURI​(java.net.URI uri,
                                                                            int readTimeout,
                                                                            int connectionTimeout)
        Method that obtains the certificate from a URI passed by parameter.
        Parameters:
        uri - target URI.
        readTimeout - Max millis to read the response.
        connectionTimeout - Max millis to connect to server.
        Returns:
        Target certificate.