Class ATSLValidator
- java.lang.Object
-
- es.gob.afirma.tsl.certValidation.impl.common.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.StringTSP_SERVICE_NAME_FOR_DIST_POINTConstant 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.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleancheckIfTSPServiceStatusIsOK(java.lang.String serviceStatus)Checks if the input service status URI defines an OK status.abstract booleancheckIfTSPServiceTypeIsCAPKC(java.lang.String tspServiceType)Checks if the input TSP Service Type is CA PKC.abstract booleancheckIfTSPServiceTypeIsCAQC(java.lang.String tspServiceType)Checks if the input TSP Service Type is CA QC.abstract booleancheckIfTSPServiceTypeIsCRLCompatible(ServiceHistoryInstance shi, boolean isCertQualified)Checks if the service type is a CRL compatible type.abstract booleancheckIfTSPServiceTypeIsOCSPCompatible(ServiceHistoryInstance shi, boolean isCertQualified)Checks if the service type is a OCSP compatible type.java.security.cert.X509CertificategetCertificateFromHTTPURI(java.net.URI uri, int readTimeout, int connectionTimeout)Method that obtains the certificate from a URI passed by parameter.ITSLValidatorResultvalidateCertificateWithTSL(java.security.cert.X509Certificate cert, boolean isCACert, boolean isTsaCertificate, java.util.Date validationDate, boolean checkStatusRevocation)Validate the status of the input certificate with the information of the TSL.
-
-
-
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
-
-
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:
validateCertificateWithTSLin interfaceITSLValidator- 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 wasnull.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:
trueif represents an OK status, otherwisefalse.
-
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:
trueif it represents a CA QC TSP Service, otherwisefalse.
-
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:
trueif it represents a CA PKC TSP Service, otherwisefalse.
-
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:
trueif the Service type is CRL compatible with the certificate to validate. otherwisefalse.
-
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:
trueif the Service type is OCSP compatible with the certificate to validate. otherwisefalse.
-
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.
-
-