public class ValidatorChainBuilder extends Object
Same instance of ValidatorChainBuilder shall not be used in multithreaded environment.
| Constructor and Description |
|---|
ValidatorChainBuilder()
Creates a ValidatorChainBuilder using default implementations
|
| Modifier and Type | Method and Description |
|---|---|
CertificateChainValidator |
buildCertificateChainValidator()
Create a new
CertificateChainValidator instance. |
CRLValidator |
buildCRLValidator()
Create a new
CRLValidator instance. |
DocumentRevisionsValidator |
buildDocumentRevisionsValidator()
Create a bew
DocumentRevisionsValidator instance with the current configuration. |
OCSPValidator |
buildOCSPValidator()
Create a new
OCSPValidator instance. |
RevocationDataValidator |
buildRevocationDataValidator()
Create a new
RevocationDataValidator instance
This method can be used to create multiple validators. |
SignatureValidator |
buildSignatureValidator(PdfDocument document)
Create a new
SignatureValidator instance with the current configuration. |
AdESReportAggregator |
getAdESReportAggregator()
Deprecated.
The AdESReportAggregator system is replaced by the
XmlReportAggregator system. |
IssuingCertificateRetriever |
getCertificateRetriever()
Retrieves the explicitly added or automatically created
IssuingCertificateRetriever instance. |
com.itextpdf.commons.actions.EventManager |
getEventManager()
Returns the EventManager to be used for all events fired during validation.
|
LotlService |
getLotlService()
Retrieves explicitly added or automatically created
LotlService instance. |
LotlTrustedStore |
getLotlTrustedStore()
Retrieves explicitly added or automatically created
LotlTrustedStore instance. |
SignatureValidationProperties |
getProperties()
Retrieves the explicitly added or automatically created
SignatureValidationProperties instance. |
QualifiedValidator |
getQualifiedValidator()
Gets
QualifiedValidator instance. |
IResourceRetriever |
getResourceRetriever()
Deprecated.
as user should not normally need this getter
|
boolean |
isEuropeanLotlTrusted()
Checks if European Union List of Trusted Lists is supposed to be trusted.
|
boolean |
padesValidationRequested()
Checks whether PAdES compliance validation was requested.
|
ValidatorChainBuilder |
trustEuropeanLotl(boolean trustEuropeanLotl)
Establishes trust in European Union List of Trusted Lists.
|
ValidatorChainBuilder |
withAdESLevelReportGenerator(XmlReportAggregator reportEventListener)
Use this reportEventListener to generate an AdES xml report.
|
ValidatorChainBuilder |
withAdESReportAggregator(AdESReportAggregator adESReportAggregator)
Deprecated.
This method will be removed in a later version, use
withAdESLevelReportGenerator(com.itextpdf.signatures.validation.report.xml.XmlReportAggregator) instead. |
ValidatorChainBuilder |
withAdvancedResourceRetriever(Supplier<com.itextpdf.io.resolver.resource.IAdvancedResourceRetriever> resourceRetrieverFactory)
Use this factory method to create instances of
IAdvancedResourceRetriever for use in the validation chain. |
ValidatorChainBuilder |
withCertificateChainValidatorFactory(Supplier<CertificateChainValidator> certificateChainValidatorFactory)
Use this factory method to create instances of
CertificateChainValidator for use in the validation chain. |
ValidatorChainBuilder |
withCrlClient(Supplier<ICrlClient> crlClientFactory)
Use this factory to create instances of
ICrlClient for use in the validation chain. |
ValidatorChainBuilder |
withCRLValidatorFactory(Supplier<CRLValidator> crlValidatorFactory)
Use this factory method to create instances of
CRLValidator for use in the validation chain. |
ValidatorChainBuilder |
withDocumentRevisionsValidatorFactory(Supplier<DocumentRevisionsValidator> documentRevisionsValidatorFactory)
Use this factory method to create instances of
DocumentRevisionsValidator
for use in the validation chain. |
ValidatorChainBuilder |
withIssuingCertificateRetrieverFactory(Supplier<IssuingCertificateRetriever> certificateRetrieverFactory)
Use this factory method to create instances of
IssuingCertificateRetriever
for use in the validation chain. |
ValidatorChainBuilder |
withKnownCertificates(Collection<Certificate> knownCertificates)
Adds known certificates to the
IssuingCertificateRetriever. |
ValidatorChainBuilder |
withLotlService(Supplier<LotlService> lotlServiceFactory)
Sets up factory which is responsible for
LotlService creation. |
ValidatorChainBuilder |
withLotlTrustedStoreFactory(Supplier<LotlTrustedStore> lotlTrustedStoreFactory)
Sets up factory which is responsible for
LotlTrustedStore creation. |
ValidatorChainBuilder |
withOcspClient(Supplier<IOcspClientBouncyCastle> ocspClientFactory)
Use this factory to create instances of
IOcspClientBouncyCastle for use in the validation chain. |
ValidatorChainBuilder |
withOCSPValidatorFactory(Supplier<OCSPValidator> ocspValidatorFactory)
Use this factory method to create instances of
OCSPValidator for use in the validation chain. |
ValidatorChainBuilder |
withPAdESLevelReportGenerator(PAdESLevelReportGenerator reportGenerator)
Use this PAdES level report generator to generate PAdES report.
|
ValidatorChainBuilder |
withQualifiedValidator(QualifiedValidator qualifiedValidator)
Sets
QualifiedValidator instance to be used during signature qualification validation. |
ValidatorChainBuilder |
withResourceRetriever(Supplier<IResourceRetriever> resourceRetrieverFactory)
|
ValidatorChainBuilder |
withRevocationDataValidatorFactory(Supplier<RevocationDataValidator> revocationDataValidatorFactory)
Use this factory method to create instances of
RevocationDataValidator for use in the validation chain. |
ValidatorChainBuilder |
withSignatureValidationProperties(SignatureValidationProperties properties)
Use this instance of a
SignatureValidationProperties in the validation chain. |
ValidatorChainBuilder |
withTrustedCertificates(Collection<Certificate> trustedCertificates)
Sets the trusted certificates to the
IssuingCertificateRetriever. |
public ValidatorChainBuilder()
public ValidatorChainBuilder trustEuropeanLotl(boolean trustEuropeanLotl)
This feature by default relies on remote resource fetching and third-party EU trusted lists posted online. iText has no influence over these resources maintained by third-party authorities.
If this feature is enabled, LotlService is created and used to retrieve,
validate and establish trust in EU List of Trusted Lists.
In order to properly work, apart from enabling it, user needs to call
LotlService.initializeGlobalCache(LotlFetchingProperties) method, which performs initial initialization.
Additionally, in order to successfully use this feature, a user needs to provide a source for trusted certificates which will be used for LOTL files validation. One can either add an explicit dependency to "eu-trusted-lists-resources" iText module or configure own source of trusted certificates. When iText dependency is used it is required to make sure that the newest version of the dependency is selected, otherwise LOTL validation will fail.
The required certificates for LOTL files validations are published in the Official Journal of the European Union.
Your own source of trusted certificates can be configured by using
EuropeanTrustedListConfigurationFactory.setFactory(Supplier).
trustEuropeanLotl - true if European Union LOTLs are expected to be trusted, false otherwiseValidatorChainBuilderpublic boolean isEuropeanLotlTrusted()
true if European Union LOTLs are expected to be trusted, false otherwisepublic SignatureValidator buildSignatureValidator(PdfDocument document)
SignatureValidator instance with the current configuration.
This method can be used to create multiple validators.document - PdfDocument instance which will be validatedpublic DocumentRevisionsValidator buildDocumentRevisionsValidator()
DocumentRevisionsValidator instance with the current configuration.
This method can be used to create multiple validators.public CertificateChainValidator buildCertificateChainValidator()
CertificateChainValidator instance.
This method can be used to create multiple validators.public RevocationDataValidator buildRevocationDataValidator()
RevocationDataValidator instance
This method can be used to create multiple validators.public OCSPValidator buildOCSPValidator()
OCSPValidator instance.
This method can be used to create multiple validators.public CRLValidator buildCRLValidator()
CRLValidator instance.
This method can be used to create multiple validators.public ValidatorChainBuilder withDocumentRevisionsValidatorFactory(Supplier<DocumentRevisionsValidator> documentRevisionsValidatorFactory)
DocumentRevisionsValidator
for use in the validation chain.documentRevisionsValidatorFactory - the document revisions validator factory method to useValidatorChainBuilderpublic ValidatorChainBuilder withCRLValidatorFactory(Supplier<CRLValidator> crlValidatorFactory)
CRLValidator for use in the validation chain.crlValidatorFactory - the CRLValidatorFactory method to useValidatorChainBuilder@Deprecated public ValidatorChainBuilder withResourceRetriever(Supplier<IResourceRetriever> resourceRetrieverFactory)
withAdvancedResourceRetriever(java.util.function.Supplier<com.itextpdf.io.resolver.resource.IAdvancedResourceRetriever>)IResourceRetriever for use in the validation chain.resourceRetrieverFactory - the ResourceRetrieverFactory method to useValidatorChainBuilderpublic ValidatorChainBuilder withAdvancedResourceRetriever(Supplier<com.itextpdf.io.resolver.resource.IAdvancedResourceRetriever> resourceRetrieverFactory)
IAdvancedResourceRetriever for use in the validation chain.
Resource retriever created by this factory will be automatically used in the default CRL client, default OCSP client and default CA issuer certificate retriever. If some custom client is set and one needs to use their custom resource retriever for it, it's their responsibility to pass custom resource retriever to their custom client.
Note that resource retriever created by this factory will not be used for LotlService because
the global instance of LotlService is used by default. If one needs to use their custom resource
retriever for LotlService, they can pass it using LotlService.withCustomResourceRetriever(com.itextpdf.io.resolver.resource.IResourceRetriever)
method.
resourceRetrieverFactory - the resource retriever factory method to useValidatorChainBuilderpublic ValidatorChainBuilder withOCSPValidatorFactory(Supplier<OCSPValidator> ocspValidatorFactory)
OCSPValidator for use in the validation chain.ocspValidatorFactory - the OCSPValidatorFactory method to useValidatorChainBuilderpublic ValidatorChainBuilder withRevocationDataValidatorFactory(Supplier<RevocationDataValidator> revocationDataValidatorFactory)
RevocationDataValidator for use in the validation chain.revocationDataValidatorFactory - the RevocationDataValidator factory method to useValidatorChainBuilderpublic ValidatorChainBuilder withCertificateChainValidatorFactory(Supplier<CertificateChainValidator> certificateChainValidatorFactory)
CertificateChainValidator for use in the validation chain.certificateChainValidatorFactory - the CertificateChainValidator factory method to useValidatorChainBuilderpublic ValidatorChainBuilder withSignatureValidationProperties(SignatureValidationProperties properties)
SignatureValidationProperties in the validation chain.properties - the SignatureValidationProperties instance to useValidatorChainBuilderpublic ValidatorChainBuilder withIssuingCertificateRetrieverFactory(Supplier<IssuingCertificateRetriever> certificateRetrieverFactory)
IssuingCertificateRetriever
for use in the validation chain.certificateRetrieverFactory - the IssuingCertificateRetriever factory method to useValidatorChainBuilderpublic ValidatorChainBuilder withOcspClient(Supplier<IOcspClientBouncyCastle> ocspClientFactory)
IOcspClientBouncyCastle for use in the validation chain.ocspClientFactory - the IOcspClient factory method to useValidatorChainBuilderpublic ValidatorChainBuilder withCrlClient(Supplier<ICrlClient> crlClientFactory)
ICrlClient for use in the validation chain.crlClientFactory - the ICrlClient factory method to useValidatorChainBuilderpublic ValidatorChainBuilder withKnownCertificates(Collection<Certificate> knownCertificates)
IssuingCertificateRetriever.knownCertificates - the list of known certificates to addValidatorChainBuilderpublic ValidatorChainBuilder withTrustedCertificates(Collection<Certificate> trustedCertificates)
IssuingCertificateRetriever.trustedCertificates - the list of trusted certificates to setValidatorChainBuilder@Deprecated public ValidatorChainBuilder withAdESReportAggregator(AdESReportAggregator adESReportAggregator)
withAdESLevelReportGenerator(com.itextpdf.signatures.validation.report.xml.XmlReportAggregator) instead.
Generated PadesValidationReport report could be provided to
XmlReportGenerator.generate(PadesValidationReport, Writer).
adESReportAggregator - the report aggregator to useValidatorChainBuilderpublic ValidatorChainBuilder withAdESLevelReportGenerator(XmlReportAggregator reportEventListener)
Generated PadesValidationReport report could be provided to
XmlReportGenerator.generate(PadesValidationReport, Writer).
reportEventListener - the AdESReportEventListener to useValidatorChainBuilderpublic ValidatorChainBuilder withPAdESLevelReportGenerator(PAdESLevelReportGenerator reportGenerator)
If called multiple times, multiple PAdESLevelReportGenerator objects will be registered.
reportGenerator - the PAdESLevelReportGenerator to useValidatorChainBuilderpublic boolean padesValidationRequested()
true if PAdES compliance validation was requested, false otherwisepublic ValidatorChainBuilder withQualifiedValidator(QualifiedValidator qualifiedValidator)
QualifiedValidator instance to be used during signature qualification validation.
The results of this validation can be obtained from this same instance.
The feature is only executed if European LOTL is used. See trustEuropeanLotl(boolean).
This validator needs to be updated per each document validation, or the results need to be obtained. Otherwise, the exception will be thrown.
If no instance is provided, the qualification validation is not executed.
qualifiedValidator - QualifiedValidator instance which performs the validationValidatorChainBuilderpublic IssuingCertificateRetriever getCertificateRetriever()
IssuingCertificateRetriever instance.IssuingCertificateRetriever instance.public SignatureValidationProperties getProperties()
SignatureValidationProperties instance.SignatureValidationProperties instance.public com.itextpdf.commons.actions.EventManager getEventManager()
@Deprecated public AdESReportAggregator getAdESReportAggregator()
XmlReportAggregator system.AdESReportAggregator instance.
Default is the NullAdESReportAggregator.AdESReportAggregator instance.@Deprecated public IResourceRetriever getResourceRetriever()
IResourceRetriever instance.IResourceRetriever instancepublic QualifiedValidator getQualifiedValidator()
QualifiedValidator instance.QualifiedValidator instancepublic ValidatorChainBuilder withLotlTrustedStoreFactory(Supplier<LotlTrustedStore> lotlTrustedStoreFactory)
LotlTrustedStore creation.lotlTrustedStoreFactory - factory responsible for LotlTrustedStore creationValidatorChainBuilderpublic LotlTrustedStore getLotlTrustedStore()
LotlTrustedStore instance.LotlTrustedStore instancepublic ValidatorChainBuilder withLotlService(Supplier<LotlService> lotlServiceFactory)
LotlService creation.lotlServiceFactory - factory responsible for LotlService creationValidatorChainBuilderpublic LotlService getLotlService()
LotlService instance.LotlService instanceCopyright © 1998–2026 Apryse Group NV. All rights reserved.