Class EuropeanLotlService
- All Implemented Interfaces:
-
AutoCloseable
-
Field Summary
Fields inherited from class com.itextpdf.signatures.validation.lotl.LotlService
lotlFetchingProperties -
Constructor Summary
ConstructorsConstructorDescriptionEuropeanLotlService(LotlFetchingProperties lotlFetchingProperties) Creates a new instance ofEuropeanLotlService. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves national trusted certificates.Get the validation results for the List of Trusted Lists (LOTL).voidloadFromCache(InputStream stream) Loads the cache from the provided input stream.protected voidLoads the cache from the network by fetching the latest LOTL data and related resources.voidserializeCache(OutputStream outputStream) Serializes the current state of the cache to the provided output stream.protected voidThis method is intended to refresh the cache, it will try to download the latest LOTL data and update the cache accordingly.withCountrySpecificLotlFetcher(CountrySpecificLotlFetcher countrySpecificLotlFetcher) Sets the country-specific LOTL fetcher for the LOTL service.Sets the European List of Trusted Lists (LOTL) byte fetcher for the LOTL service.withEuropeanResourceFetcher(EuropeanResourceFetcher europeanResourceFetcher) Sets the European Resource Fetcher for theLotlService.Sets the cache for theLotlService.withPivotFetcher(PivotFetcher pivotFetcher) Sets the pivot fetcher for the LOTL service.Methods inherited from class com.itextpdf.signatures.validation.lotl.LotlService
cancelTimer, close, getGlobalService, initializeCache, initializeCache, initializeGlobalCache, setupTimer, withCustomResourceRetriever, withLotlValidator, withXmlSignatureValidator
-
Constructor Details
-
EuropeanLotlService
Creates a new instance ofEuropeanLotlService.- Parameters:
-
lotlFetchingProperties-LotlFetchingPropertiesto configure the way in which LOTL will be fetched
-
-
Method Details
-
withLotlServiceCache
Sets the cache for theLotlService.This method allows you to provide a custom implementation of
LotlServiceCacheto be used for caching LOTL data, pivot files, and country-specific LOTLs.- Overrides:
-
withLotlServiceCachein classLotlService - Parameters:
-
cache- the custom cache to be used for caching LOTL data - Returns:
-
the current instance of
LotlServicefor method chaining
-
loadFromCache
Loads the cache from the provided input stream.The input stream should contain serialized cache data, which can be created using the
LotlService.serializeCache(OutputStream)method.- Overrides:
-
loadFromCachein classLotlService - Parameters:
-
stream- the input stream to read the cached data from
-
getValidationResult
Get the validation results for the List of Trusted Lists (LOTL).- Overrides:
-
getValidationResultin classLotlService - Returns:
-
a
ValidationReportcontaining the results of the LOTL validation
-
getNationalTrustedCertificates
Retrieves national trusted certificates.- Overrides:
-
getNationalTrustedCertificatesin classLotlService - Returns:
- the list of the national trusted certificates
-
withPivotFetcher
Sets the pivot fetcher for the LOTL service.- Overrides:
-
withPivotFetcherin classLotlService - Parameters:
-
pivotFetcher- the pivot fetcher to be used for fetching and validating pivot files - Returns:
-
the current instance of
LotlServicefor method chaining
-
withCountrySpecificLotlFetcher
public LotlService withCountrySpecificLotlFetcher(CountrySpecificLotlFetcher countrySpecificLotlFetcher) Sets the country-specific LOTL fetcher for the LOTL service.- Overrides:
-
withCountrySpecificLotlFetcherin classLotlService - Parameters:
-
countrySpecificLotlFetcher- the country-specific LOTL fetcher to be used for fetching and validating country-specific LOTLs - Returns:
-
the current instance of
LotlServicefor method chaining
-
withEuropeanLotlFetcher
Sets the European List of Trusted Lists (LOTL) byte fetcher for the LOTL service.- Overrides:
-
withEuropeanLotlFetcherin classLotlService - Parameters:
-
fetcher- the fetcher to be used for fetching the LOTL XML data - Returns:
-
the current instance of
LotlServicefor method chaining
-
withEuropeanResourceFetcher
Sets the European Resource Fetcher for theLotlService.- Overrides:
-
withEuropeanResourceFetcherin classLotlService - Parameters:
-
europeanResourceFetcher- the European Resource Fetcher to be used for fetching EU journal certificates - Returns:
-
the current instance of
LotlServicefor method chaining
-
serializeCache
Serializes the current state of the cache to the provided output stream.- Overrides:
-
serializeCachein classLotlService - Parameters:
-
outputStream- the output stream to which the cache will be serialized.
-
loadFromNetwork
protected void loadFromNetwork()Loads the cache from the network by fetching the latest LOTL data and related resources.This method fetches the main LOTL file, EU journal certificates, pivot files, and country-specific LOTLs, validates them, and stores them in the cache.
If the main LOTL fetch fails, the method will throw a
PdfExceptionand will not proceed to fetch pivot files or country-specific LOTLs. If a country-specific LOTL fetch fails, theLotlFetchingProperties.getOnCountryFetchFailureStrategy()will be used to handle the failure.Note: This method is called during cache initialization and should not be called directly in normal operation.
- Overrides:
-
loadFromNetworkin classLotlService
-
tryAndRefreshCache
protected void tryAndRefreshCache()This method is intended to refresh the cache, it will try to download the latest LOTL data and update the cache accordingly.The rules taken into account are: Country specific LOTL files will be fetched, validated and updated per country. If country fails to fetch,
LotlFetchingProperties.getOnCountryFetchFailureStrategy()will be used to perform corresponding action.For the main LOTL file, if the fetch fails, the cache will not be updated. Also, we will NOT proceed to update the pivot files. If the main LOTL file is fetched successfully, the pivot files will be fetched, validated and stored in the cache.
- Overrides:
-
tryAndRefreshCachein classLotlService
-