Class ValidatorChainBuilder
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a ValidatorChainBuilder using default implementations -
Method Summary
Modifier and TypeMethodDescriptionCreate a newCertificateChainValidatorinstance.Create a newCRLValidatorinstance.Create a bewDocumentRevisionsValidatorinstance with the current configuration.Create a newOCSPValidatorinstance.Create a newRevocationDataValidatorinstance This method can be used to create multiple validators.buildSignatureValidator(PdfDocument document) Create a newSignatureValidatorinstance with the current configuration.Retrieves the explicitly added or automatically createdAdESReportAggregatorinstance.Retrieves the explicitly added or automatically createdIssuingCertificateRetrieverinstance.Retrieves explicitly added or automatically createdLotlServiceinstance.Retrieves explicitly added or automatically createdLotlTrustedStoreinstance.Retrieves the explicitly added or automatically createdSignatureValidationPropertiesinstance.Retrieves the explicitly added or automatically createdIResourceRetrieverinstance.booleanChecks if European Union List of Trusted Lists is supposed to be trusted.trustEuropeanLotl(boolean trustEuropeanLotl) Establishes trust in European Union List of Trusted Lists.withAdESReportAggregator(AdESReportAggregator adESReportAggregator) Use this AdES report aggregator to enable AdES compliant report generation.withCertificateChainValidatorFactory(Supplier<CertificateChainValidator> certificateChainValidatorFactory) Use this factory method to create instances ofCertificateChainValidatorfor use in the validation chain.withCrlClient(Supplier<ICrlClient> crlClientFactory) Use this factory to create instances ofICrlClientfor use in the validation chain.withCRLValidatorFactory(Supplier<CRLValidator> crlValidatorFactory) Use this factory method to create instances ofCRLValidatorfor use in the validation chain.withDocumentRevisionsValidatorFactory(Supplier<DocumentRevisionsValidator> documentRevisionsValidatorFactory) Use this factory method to create instances ofDocumentRevisionsValidatorfor use in the validation chain.withIssuingCertificateRetrieverFactory(Supplier<IssuingCertificateRetriever> certificateRetrieverFactory) Use this factory method to create instances ofIssuingCertificateRetrieverfor use in the validation chain.withKnownCertificates(Collection<Certificate> knownCertificates) Adds known certificates to theIssuingCertificateRetriever.withLotlService(Supplier<LotlService> lotlServiceFactory) Sets up factory which is responsible forLotlServicecreation.withLotlTrustedStoreFactory(Supplier<LotlTrustedStore> lotlTrustedStoreFactory) Sets up factory which is responsible forLotlTrustedStorecreation.withOcspClient(Supplier<IOcspClientBouncyCastle> ocspClientFactory) Use this factory to create instances ofIOcspClientBouncyCastlefor use in the validation chain.withOCSPValidatorFactory(Supplier<OCSPValidator> ocspValidatorFactory) Use this factory method to create instances ofOCSPValidatorfor use in the validation chain.withResourceRetriever(Supplier<IResourceRetriever> resourceRetrieverFactory) Use this factory method to create instances ofIResourceRetrieverfor use in the validation chain.withRevocationDataValidatorFactory(Supplier<RevocationDataValidator> revocationDataValidatorFactory) Use this factory method to create instances ofRevocationDataValidatorfor use in the validation chain.Use this instance of aSignatureValidationPropertiesin the validation chain.withTrustedCertificates(Collection<Certificate> trustedCertificates) Sets the trusted certificates to theIssuingCertificateRetriever.
-
Constructor Details
-
ValidatorChainBuilder
public ValidatorChainBuilder()Creates a ValidatorChainBuilder using default implementations
-
-
Method Details
-
trustEuropeanLotl
Establishes trust in European Union List of Trusted Lists.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,
LotlServiceis 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).- Parameters:
-
trustEuropeanLotl-trueif European Union LOTLs are expected to be trusted,falseotherwise - Returns:
- current ValidatorChainBuilder.
-
isEuropeanLotlTrusted
public boolean isEuropeanLotlTrusted()Checks if European Union List of Trusted Lists is supposed to be trusted.- Returns:
-
trueif European Union LOTLs are expected to be trusted,falseotherwise
-
buildSignatureValidator
Create a newSignatureValidatorinstance with the current configuration. This method can be used to create multiple validators.- Parameters:
-
document-PdfDocumentinstance which will be validated - Returns:
- a new instance of a signature validator.
-
buildDocumentRevisionsValidator
Create a bewDocumentRevisionsValidatorinstance with the current configuration. This method can be used to create multiple validators.- Returns:
- a new instance of a document revisions validator.
-
buildCertificateChainValidator
Create a newCertificateChainValidatorinstance. This method can be used to create multiple validators.- Returns:
- a new instance of a CertificateChainValidator.
-
buildRevocationDataValidator
Create a newRevocationDataValidatorinstance This method can be used to create multiple validators.- Returns:
- a new instance of a RevocationDataValidator.
-
buildOCSPValidator
Create a newOCSPValidatorinstance. This method can be used to create multiple validators.- Returns:
- a new instance of a OCSPValidator.
-
buildCRLValidator
Create a newCRLValidatorinstance. This method can be used to create multiple validators.- Returns:
- a new instance of a CRLValidator.
-
withDocumentRevisionsValidatorFactory
public ValidatorChainBuilder withDocumentRevisionsValidatorFactory(Supplier<DocumentRevisionsValidator> documentRevisionsValidatorFactory) Use this factory method to create instances ofDocumentRevisionsValidatorfor use in the validation chain.- Parameters:
-
documentRevisionsValidatorFactory- the document revisions validator factory method to use - Returns:
- the current ValidatorChainBuilder.
-
withCRLValidatorFactory
Use this factory method to create instances ofCRLValidatorfor use in the validation chain.- Parameters:
-
crlValidatorFactory- the CRLValidatorFactory method to use - Returns:
- the current ValidatorChainBuilder.
-
withResourceRetriever
public ValidatorChainBuilder withResourceRetriever(Supplier<IResourceRetriever> resourceRetrieverFactory) Use this factory method to create instances ofIResourceRetrieverfor use in the validation chain.- Parameters:
-
resourceRetrieverFactory- the ResourceRetrieverFactory method to use. - Returns:
- the current ValidatorChainBuilder.
-
withOCSPValidatorFactory
public ValidatorChainBuilder withOCSPValidatorFactory(Supplier<OCSPValidator> ocspValidatorFactory) Use this factory method to create instances ofOCSPValidatorfor use in the validation chain.- Parameters:
-
ocspValidatorFactory- the OCSPValidatorFactory method to use - Returns:
- the current ValidatorChainBuilder.
-
withRevocationDataValidatorFactory
public ValidatorChainBuilder withRevocationDataValidatorFactory(Supplier<RevocationDataValidator> revocationDataValidatorFactory) Use this factory method to create instances ofRevocationDataValidatorfor use in the validation chain.- Parameters:
-
revocationDataValidatorFactory- the RevocationDataValidator factory method to use - Returns:
- the current ValidatorChainBuilder.
-
withCertificateChainValidatorFactory
public ValidatorChainBuilder withCertificateChainValidatorFactory(Supplier<CertificateChainValidator> certificateChainValidatorFactory) Use this factory method to create instances ofCertificateChainValidatorfor use in the validation chain.- Parameters:
-
certificateChainValidatorFactory- the CertificateChainValidator factory method to use - Returns:
- the current ValidatorChainBuilder.
-
withSignatureValidationProperties
public ValidatorChainBuilder withSignatureValidationProperties(SignatureValidationProperties properties) Use this instance of aSignatureValidationPropertiesin the validation chain.- Parameters:
-
properties- the SignatureValidationProperties instance to use - Returns:
- the current ValidatorChainBuilder.
-
withIssuingCertificateRetrieverFactory
public ValidatorChainBuilder withIssuingCertificateRetrieverFactory(Supplier<IssuingCertificateRetriever> certificateRetrieverFactory) Use this factory method to create instances ofIssuingCertificateRetrieverfor use in the validation chain.- Parameters:
-
certificateRetrieverFactory- the IssuingCertificateRetriever factory method to use - Returns:
- the current ValidatorChainBuilder.
-
withOcspClient
Use this factory to create instances ofIOcspClientBouncyCastlefor use in the validation chain.- Parameters:
-
ocspClientFactory- the IOcspClient factory method to use - Returns:
- the current ValidatorChainBuilder.
-
withCrlClient
Use this factory to create instances ofICrlClientfor use in the validation chain.- Parameters:
-
crlClientFactory- the ICrlClient factory method to use - Returns:
- the current ValidatorChainBuilder.
-
withKnownCertificates
Adds known certificates to theIssuingCertificateRetriever.- Parameters:
-
knownCertificates- the list of known certificates to add - Returns:
- the current ValidatorChainBuilder.
-
withTrustedCertificates
Sets the trusted certificates to theIssuingCertificateRetriever.- Parameters:
-
trustedCertificates- the list of trusted certificates to set - Returns:
- the current ValidatorChainBuilder.
-
withAdESReportAggregator
Use this AdES report aggregator to enable AdES compliant report generation.Generated
PadesValidationReportreport could be provided toXmlReportGenerator.generate(PadesValidationReport, Writer).- Parameters:
-
adESReportAggregator- the report aggregator to use - Returns:
- the current ValidatorChainBuilder
-
getCertificateRetriever
Retrieves the explicitly added or automatically createdIssuingCertificateRetrieverinstance.- Returns:
-
the explicitly added or automatically created
IssuingCertificateRetrieverinstance.
-
getProperties
Retrieves the explicitly added or automatically createdSignatureValidationPropertiesinstance.- Returns:
-
the explicitly added or automatically created
SignatureValidationPropertiesinstance.
-
getAdESReportAggregator
Retrieves the explicitly added or automatically createdAdESReportAggregatorinstance. Default is theNullAdESReportAggregator.- Returns:
-
the explicitly added or automatically created
AdESReportAggregatorinstance.
-
getResourceRetriever
Retrieves the explicitly added or automatically createdIResourceRetrieverinstance.- Returns:
-
the explicitly added or automatically created
IResourceRetrieverinstance.
-
withLotlTrustedStoreFactory
public ValidatorChainBuilder withLotlTrustedStoreFactory(Supplier<LotlTrustedStore> lotlTrustedStoreFactory) Sets up factory which is responsible forLotlTrustedStorecreation.- Parameters:
-
lotlTrustedStoreFactory- factory responsible forLotlTrustedStorecreation - Returns:
-
this same instance of
ValidatorChainBuilder
-
getLotlTrustedStore
Retrieves explicitly added or automatically createdLotlTrustedStoreinstance.- Returns:
-
explicitly added or automatically created
LotlTrustedStoreinstance
-
withLotlService
Sets up factory which is responsible forLotlServicecreation.- Parameters:
-
lotlServiceFactory- factory responsible forLotlServicecreation - Returns:
-
this same instance of
ValidatorChainBuilder
-
getLotlService
Retrieves explicitly added or automatically createdLotlServiceinstance.- Returns:
-
explicitly added or automatically created
LotlServiceinstance
-