Class SingleFileLotlService

java.lang.Object
com.itextpdf.signatures.validation.lotl.LotlService
com.itextpdf.signatures.validation.lotl.SingleFileLotlService
All Implemented Interfaces:
AutoCloseable

public class SingleFileLotlService extends LotlService
This class provides services for managing the single country List of Trusted Lists (LOTL) and related resources. It includes methods for fetching, validating, and caching LOTL data.

You should use this service if you have only a country specific LOTL file with certificates you trust. First, you create an instance of CountrySpecificLotl and then pass it to the constructor of SingleFileLotlService together with fetching properties and the certificates to validate LOTL file. Then this instance can be passed to ValidatorChainBuilder.withLotlService(java.util.function.Supplier) so that the certificates from the LOTL file are used for signature validation.

  • Constructor Details

  • Method Details

    • loadFromCache

      public void loadFromCache (InputStream in)
      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:
      loadFromCache in class LotlService
      Parameters:
      in - the input stream to read the cached data from
    • serializeCache

      public void serializeCache (OutputStream outputStream) throws IOException
      Serializes the current state of the cache to the provided output stream.
      Overrides:
      serializeCache in class LotlService
      Parameters:
      outputStream - the output stream to which the cache will be serialized
      Throws:
      IOException - if an I/O error occurs during serialization
    • getValidationResult

      public ValidationReport getValidationResult()
      Get the validation results for the List of Trusted Lists (LOTL).
      Overrides:
      getValidationResult in class LotlService
      Returns:
      a ValidationReport containing the results of the LOTL validation
    • getNationalTrustedCertificates

      public List<IServiceContext> getNationalTrustedCertificates()
      Retrieves national trusted certificates.
      Overrides:
      getNationalTrustedCertificates in class LotlService
      Returns:
      the list of the national trusted certificates
    • 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.

      Note: This method is called during cache initialization and should not be called directly in normal operation.

      Overrides:
      loadFromNetwork in class LotlService