Class ValidatorChainBuilder
java.lang.Object
com.itextpdf.signatures.validation.ValidatorChainBuilder
A builder class to construct all necessary parts of a validation chain. The builder can be reused to create multiple instances of a validator.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a ValidatorChainBuilder using default implementations -
Method Summary
Modifier and TypeMethodDescriptionCreate a newCertificateChainValidator
instance.Create a newCRLValidator
instance.Create a bewDocumentRevisionsValidator
instance with the current configuration.Create a newOCSPValidator
instance.Create a newRevocationDataValidator
instance This method can be used to create multiple validators.buildSignatureValidator
(PdfDocument document) Create a newSignatureValidator
instance with the current configuration.Retrieves the explicitly added or automatically createdAdESReportAggregator
instance.Retrieves the explicitly added or automatically createdIssuingCertificateRetriever
instance.Retrieves the explicitly added or automatically createdSignatureValidationProperties
instance.Retrieves the explicitly added or automatically createdIResourceRetriever
instance.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 ofCertificateChainValidator
for use in the validation chain.withCrlClient
(Supplier<ICrlClient> crlClientFactory) Use this factory to create instances ofICrlClient
for use in the validation chain.withCRLValidatorFactory
(Supplier<CRLValidator> crlValidatorFactory) Use this factory method to create instances ofCRLValidator
for use in the validation chain.withDocumentRevisionsValidatorFactory
(Supplier<DocumentRevisionsValidator> documentRevisionsValidatorFactory) Use this factory method to create instances ofDocumentRevisionsValidator
for use in the validation chain.withIssuingCertificateRetrieverFactory
(Supplier<IssuingCertificateRetriever> certificateRetrieverFactory) Use this factory method to create instances ofIssuingCertificateRetriever
for use in the validation chain.withKnownCertificates
(Collection<Certificate> knownCertificates) Adds known certificates to theIssuingCertificateRetriever
.withOcspClient
(Supplier<IOcspClientBouncyCastle> ocspClientFactory) Use this factory to create instances ofIOcspClientBouncyCastle
for use in the validation chain.withOCSPValidatorFactory
(Supplier<OCSPValidator> ocspValidatorFactory) Use this factory method to create instances ofOCSPValidator
for use in the validation chain.withResourceRetriever
(Supplier<IResourceRetriever> resourceRetrieverFactory) Use this factory method to create instances ofIResourceRetriever
for use in the validation chain.withRevocationDataValidatorFactory
(Supplier<RevocationDataValidator> revocationDataValidatorFactory) Use this factory method to create instances ofRevocationDataValidator
for use in the validation chain.Use this instance of aSignatureValidationProperties
in 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
-
buildSignatureValidator
Create a newSignatureValidator
instance with the current configuration. This method can be used to create multiple validators.- Parameters:
-
document
-PdfDocument
instance which will be validated - Returns:
- a new instance of a signature validator.
-
buildDocumentRevisionsValidator
Create a bewDocumentRevisionsValidator
instance 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 newCertificateChainValidator
instance. This method can be used to create multiple validators.- Returns:
- a new instance of a CertificateChainValidator.
-
buildRevocationDataValidator
Create a newRevocationDataValidator
instance This method can be used to create multiple validators.- Returns:
- a new instance of a RevocationDataValidator.
-
buildOCSPValidator
Create a newOCSPValidator
instance. This method can be used to create multiple validators.- Returns:
- a new instance of a OCSPValidator.
-
buildCRLValidator
Create a newCRLValidator
instance. 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 ofDocumentRevisionsValidator
for 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 ofCRLValidator
for 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 ofIResourceRetriever
for 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 ofOCSPValidator
for 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 ofRevocationDataValidator
for 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 ofCertificateChainValidator
for 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 aSignatureValidationProperties
in 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 ofIssuingCertificateRetriever
for use in the validation chain.- Parameters:
-
certificateRetrieverFactory
- the IssuingCertificateRetriever factory method to use - Returns:
- the current ValidatorChainBuilder.
-
withOcspClient
Use this factory to create instances ofIOcspClientBouncyCastle
for use in the validation chain.- Parameters:
-
ocspClientFactory
- the IOcspClient factory method to use - Returns:
- the current ValidatorChainBuilder.
-
withCrlClient
Use this factory to create instances ofICrlClient
for 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
PadesValidationReport
report 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 createdIssuingCertificateRetriever
instance.- Returns:
-
the explicitly added or automatically created
IssuingCertificateRetriever
instance.
-
getProperties
Retrieves the explicitly added or automatically createdSignatureValidationProperties
instance.- Returns:
-
the explicitly added or automatically created
SignatureValidationProperties
instance.
-
getAdESReportAggregator
Retrieves the explicitly added or automatically createdAdESReportAggregator
instance. Default is theNullAdESReportAggregator
.- Returns:
-
the explicitly added or automatically created
AdESReportAggregator
instance.
-
getResourceRetriever
Retrieves the explicitly added or automatically createdIResourceRetriever
instance.- Returns:
-
the explicitly added or automatically created
IResourceRetriever
instance.
-