Package eu.europa.esig.dss.validation
Class CertificateValidator
java.lang.Object
eu.europa.esig.dss.validation.CertificateValidator
- All Implemented Interfaces:
ProcessExecutorProvider<CertificateProcessExecutor>
public class CertificateValidator
extends Object
implements ProcessExecutorProvider<CertificateProcessExecutor>
Validates a CertificateToken
-
Method Summary
Modifier and TypeMethodDescriptionprotected voidChecks if the Validator configuration is validprotected DiagnosticDataBuildercreateDiagnosticDataBuilder(ValidationContext validationContext) Creates and fills theDiagnosticDataBuilderwith a relevant dataprotected ValidationContextThis method creates a new instance ofValidationContextperforming preparation of validation data, certificate chain building, revocation request, as well as custom validation checks execution.static CertificateValidatorfromCertificate(CertificateToken token) Creates a CertificateValidator from a certificateTokenReturns a default for a validator process executorfinal XmlDiagnosticDataThis method retrievesXmlDiagnosticDatacontaining all information relevant for the validation process, including the certificate and revocation tokens obtained from online resources, e.g.protected DiagnosticDataBuilderCreates aDiagnosticDataBuilderprotected ValidationContextprepareValidationContext(CertificateVerifier certificateVerifier) Initializes and fillsValidationContextfor a certificate token validationGets theCertificateProcessExecutorvoidsetCertificateVerifier(CertificateVerifier certificateVerifier) Sets the CertificateVerifiervoidsetDefaultDigestAlgorithm(DigestAlgorithm digestAlgorithm) This method allows to change the Digest Algorithm that will be used for tokens' digest calculation Default :DigestAlgorithm.SHA256voidSets the Locale to use for messages in reportsvoidsetProcessExecutor(CertificateProcessExecutor processExecutor) This method provides the possibility to set the specificCustomProcessExecutorvoidsetTokenExtractionStrategy(TokenExtractionStrategy tokenExtractionStrategy) Sets the TokenExtractionStrategyvoidsetTokenIdentifierProvider(TokenIdentifierProvider identifierProvider) Sets the TokenIdentifierProvidervoidsetValidationContextExecutor(ValidationContextExecutor validationContextExecutor) This method setsValidationContextExecutorfor validation of the preparedValidationContextDefault: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)voidsetValidationTime(Date validationTime) Sets the validationTimevalidate()Validates the certificate with a default validation policyvalidate(ValidationPolicy validationPolicy) Validated the certificate with a custom validation policyvalidate(InputStream policyDataStream) This method validates a certificate with the given validation policyInputStreamprotected voidvalidateContext(ValidationContext validationContext) Process the validation
-
Method Details
-
fromCertificate
Creates a CertificateValidator from a certificateToken- Parameters:
token-CertificateToken- Returns:
CertificateValidator
-
setCertificateVerifier
Sets the CertificateVerifier- Parameters:
certificateVerifier-CertificateVerifier
-
setTokenExtractionStrategy
Sets the TokenExtractionStrategy- Parameters:
tokenExtractionStrategy-TokenExtractionStrategy
-
setTokenIdentifierProvider
Sets the TokenIdentifierProvider- Parameters:
identifierProvider-TokenIdentifierProvider
-
setValidationTime
-
setLocale
-
setValidationContextExecutor
This method setsValidationContextExecutorfor validation of the preparedValidationContextDefault: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
This method allows to change the Digest Algorithm that will be used for tokens' digest calculation Default :DigestAlgorithm.SHA256- Parameters:
digestAlgorithm-DigestAlgorithmto use
-
validate
Validates the certificate with a default validation policy- Returns:
CertificateReports
-
validate
This method validates a certificate with the given validation policyInputStream- Parameters:
policyDataStream-InputStreamrepresenting the XML Validation Policy file- Returns:
CertificateReports
-
validate
Validated the certificate with a custom validation policy- Parameters:
validationPolicy-ValidationPolicy- Returns:
CertificateReports
-
assertConfigurationValid
protected void assertConfigurationValid()Checks if the Validator configuration is valid -
getDiagnosticData
This method retrievesXmlDiagnosticDatacontaining all information relevant for the validation process, including the certificate and revocation tokens obtained from online resources, e.g. AIA, CRL, OCSP (when applicable).- Returns:
XmlDiagnosticData
-
prepareValidationContext
Initializes and fillsValidationContextfor a certificate token validation- Parameters:
certificateVerifier-CertificateVerifierto be used- Returns:
ValidationContext
-
createValidationContext
This method creates a new instance ofValidationContextperforming preparation of validation data, certificate chain building, revocation request, as well as custom validation checks execution.- Returns:
ValidationContext
-
prepareDiagnosticDataBuilder
Creates aDiagnosticDataBuilder- Returns:
DiagnosticDataBuilder
-
validateContext
Process the validation- Parameters:
validationContext-ValidationContextto process
-
createDiagnosticDataBuilder
Creates and fills theDiagnosticDataBuilderwith a relevant data- Parameters:
validationContext-ValidationContextused for the validation- Returns:
- filled
DiagnosticDataBuilder
-
setProcessExecutor
Description copied from interface:ProcessExecutorProviderThis method provides the possibility to set the specificCustomProcessExecutor- Specified by:
setProcessExecutorin interfaceProcessExecutorProvider<CertificateProcessExecutor>- Parameters:
processExecutor-ProcessExecutor
-
provideProcessExecutorInstance
Gets theCertificateProcessExecutor- Returns:
CertificateProcessExecutor
-
getDefaultProcessExecutor
Description copied from interface:ProcessExecutorProviderReturns a default for a validator process executor- Specified by:
getDefaultProcessExecutorin interfaceProcessExecutorProvider<CertificateProcessExecutor>- Returns:
- Process Executor
-