Class AbstractCertificateValidator<R extends AbstractReports, PE extends ProcessExecutor<R>>
- Type Parameters:
R-AbstractReportsPE-ProcessExecutor
- All Implemented Interfaces:
ProcessExecutorProvider<PE>
- Direct Known Subclasses:
CertificateValidator, QWACValidator
eu.europa.esig.dss.model.x509.CertificateToken validation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CertificateVerifierThe CertificateVerifier to useprotected DigestAlgorithmThis variable set the default Digest Algorithm what will be used for calculation of digests for validation tokens and signed data Default: SHA256protected TokenIdentifierProviderThe token identifier provider to useprotected LocaleLocale to use for reports generation By default a Locale from OS is usedprotected PEThe CertificateProcessExecutorprotected TokenExtractionStrategyThe TokenExtractionStrategyprotected ValidationContextExecutorPerforms validation ofValidationContextDefault :DefaultValidationContextExecutorprotected DateThe validation time -
Constructor Summary
Constructors -
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.protected ValidationPolicyLoaderGets a default validation policy loader for a certificate validationprotected abstract StringReturns the default validation policy pathfinal XmlDiagnosticDataThis method retrievesXmlDiagnosticDatacontaining all information relevant for the validation process, including the certificate and revocation tokens obtained from online resources, e.g.protected DateGets the validation timeprotected DiagnosticDataBuilderInstantiates a new DiagnosticDataBuilderprotected ValidationPolicyloadValidationPolicy(DSSDocument policyDocument, DSSDocument cryptographicSuiteDocument) This method loads a validation policy from thepolicyDocumentand acryptographicSuiteDocument.protected DiagnosticDataBuilderCreates aDiagnosticDataBuilderprotected ValidationContextprepareValidationContext(CertificateVerifier certificateVerifier) Initializes and fillsValidationContextfor a certificate token validationprotected abstract PEGets theProcessExecutorvoidsetCertificateVerifier(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(PE 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(DSSDocument policyDocument) Validates the certificate with the validation policy obtained frompolicyDocument.validate(DSSDocument policyDocument, DSSDocument cryptographicSuiteDocument) Validates the certificate using the provided validation policy and a cryptographic suite.validate(ValidationPolicy validationPolicy) Validated the certificate with a custom validation policyValidates the certificate with the validation policy obtained frompolicyFile.Validates the certificate using the provided validation policy and a cryptographic suite.validate(InputStream policyDataStream) Validates the document and all its signatures.validate(InputStream policyDataStream, InputStream cryptographicSuiteStream) Validates the certificate using the provided validation policy and a cryptographic suite.Validates the certificate with the validation policy obtained frompolicyResourcePath.Validates the certificate using the provided validation policy and a cryptographic suite.Validates the certificate with the validation policy obtained fromvalidationPolicyURL.Validates the certificate using the provided validation policy and a cryptographic suite.protected voidvalidateContext(ValidationContext validationContext) Process the validationMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ProcessExecutorProvider
getDefaultProcessExecutor
-
Field Details
-
validationTime
The validation time -
certificateVerifier
The CertificateVerifier to use -
tokenExtractionStrategy
The TokenExtractionStrategy -
identifierProvider
The token identifier provider to use -
validationContextExecutor
Performs validation ofValidationContextDefault :DefaultValidationContextExecutor -
locale
Locale to use for reports generation By default a Locale from OS is used -
processExecutor
The CertificateProcessExecutor -
defaultDigestAlgorithm
This variable set the default Digest Algorithm what will be used for calculation of digests for validation tokens and signed data Default: SHA256
-
-
Constructor Details
-
AbstractCertificateValidator
protected AbstractCertificateValidator()Default constructor
-
-
Method Details
-
setCertificateVerifier
Sets the CertificateVerifier- Parameters:
certificateVerifier-CertificateVerifier
-
setTokenExtractionStrategy
Sets the TokenExtractionStrategy- Parameters:
tokenExtractionStrategy-TokenExtractionStrategy
-
setTokenIdentifierProvider
Sets the TokenIdentifierProvider- Parameters:
identifierProvider-TokenIdentifierProvider
-
setValidationTime
-
setLocale
-
getValidationTime
-
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
Validates the certificate with the validation policy obtained fromvalidationPolicyURL. If null the default file is used.- Parameters:
validationPolicyURL-URL- Returns:
CertificateReports
-
validate
Validates the certificate with the validation policy obtained frompolicyResourcePath. If null or empty the default file is used.- Parameters:
policyResourcePath- is located against the classpath (getClass().getResourceAsStream), and NOT the filesystem- Returns:
CertificateReports
-
validate
Validates the certificate with the validation policy obtained frompolicyFile. If null or file does not exist the default file is used.- Parameters:
policyFile- contains the validation policy (xml) asFile- Returns:
CertificateReports
-
validate
Validates the certificate with the validation policy obtained frompolicyDocument. If null the default file is used.- Parameters:
policyDocument- contains the validation policy (xml) asDSSDocument- Returns:
CertificateReports
-
validate
Validates the document and all its signatures. The policyDataStream contains the constraint file. If null the default file is used.- Parameters:
policyDataStream- theInputStreamwith the validation policy- Returns:
CertificateReports
-
validate
Validates the certificate using the provided validation policy and a cryptographic suite. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please useeu.europa.esig.dss.validation.policy.ValidationPolicyLoader.The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.
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.
- Parameters:
validationPolicyURL-URLto the used validation policy filecryptographicSuiteURL-URLto the used cryptographic suite file- Returns:
CertificateReports
-
validate
Validates the certificate using the provided validation policy and a cryptographic suite. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please useeu.europa.esig.dss.validation.policy.ValidationPolicyLoader.The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.
The
policyResourcePathandcryptographicSuitePathspecify the constraint file. If null or empty the default file is used.- Parameters:
policyResourcePath-Stringpath to the validation policy file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystemcryptographicSuitePath-Stringpath to the cryptographic suite file, located against the classpath (getClass().getResourceAsStream), and NOT the filesystem- Returns:
CertificateReports
-
validate
Validates the certificate using the provided validation policy and a cryptographic suite. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please useeu.europa.esig.dss.validation.policy.ValidationPolicyLoader.The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.
The
Fileparameters specify the constraint file. If null the default file is used.- Parameters:
policyFile-Filecontaining the validation policycryptographicSuiteFile-Filecontaining the cryptographic suite- Returns:
CertificateReports
-
validate
Validates the certificate using the provided validation policy and a cryptographic suite. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please useeu.europa.esig.dss.validation.policy.ValidationPolicyLoader.The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.
The
DSSDocumentparameters contains the constraint files. If null the default file is used.- Parameters:
policyDocument-DSSDocumentcontaining the validation policycryptographicSuiteDocument-DSSDocumentcontaining the cryptographic suite- Returns:
CertificateReports
-
loadValidationPolicy
protected ValidationPolicy loadValidationPolicy(DSSDocument policyDocument, DSSDocument cryptographicSuiteDocument) This method loads a validation policy from thepolicyDocumentand acryptographicSuiteDocument. When a document is not provided, a default policy or cryptographic suite is used, respectively.- Parameters:
policyDocument-DSSDocumentcontaining the validation policy documentcryptographicSuiteDocument-DSSDocumentcontaining the cryptographic suite document- Returns:
ValidationPolicy
-
fromDefaultCertificateValidationPolicyLoader
Gets a default validation policy loader for a certificate validation- Returns:
ValidationPolicyLoader
-
getDefaultValidationPolicyPath
-
validate
Validates the certificate using the provided validation policy and a cryptographic suite. If cryptographic suite is set, the constraints from validation policy will be overwritten by the constraints retrieved from the cryptographic suite. When set, the cryptographic suite constraints are applied with the default behavior, using FAIL level. For a customizable cryptographic suite and its applicability context, please useeu.europa.esig.dss.validation.policy.ValidationPolicyLoader.The format of validation policy should correspond to the DSS XML Validation policy (please include 'dss-policy-jaxb' module in your classpath), unless a custom validation policy has been implemented. The format of cryptographic suite should correspond to XML or JSON schema as defined in ETSI TS 119 322 (please include 'dss-policy-crypto-xml' or 'dss-policy-crypto-json' to the classpath), unless a custom cryptographic suite has been implemented.
The
InputStreamparameters contains the constraint files. If null the default file is used.- Parameters:
policyDataStream-InputStreamcontaining the validation policycryptographicSuiteStream-InputStreamcontaining the cryptographic suite- 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
-
initDiagnosticDataBuilder
Instantiates a new DiagnosticDataBuilder- Returns:
DiagnosticDataBuilder
-
provideProcessExecutorInstance
Gets theProcessExecutor- Returns:
ProcessExecutor
-
setProcessExecutor
Description copied from interface:ProcessExecutorProviderThis method provides the possibility to set the specificCustomProcessExecutor- Specified by:
setProcessExecutorin interfaceProcessExecutorProvider<R extends AbstractReports>- Parameters:
processExecutor-ProcessExecutor
-