Class LotlFetchingProperties

java.lang.Object
com.itextpdf.signatures.validation.lotl.LotlFetchingProperties

public class LotlFetchingProperties extends Object
Class which stores properties related to LOTL (List of Trusted Lists) fetching and validation process.
  • Constructor Details

  • Method Details

    • setCountryNames

      public LotlFetchingProperties setCountryNames (String... countryNames)
      Adds schema name (usually two letters) of a country which shall be used during LOTL fetching.

      This method cannot be used together with setCountryNamesToIgnore(String...).

      If no schema names are added or ignored, all country specific LOTL files will be used.

      Most of the country names are present in LotlCountryCodeConstants class.

      Parameters:
      countryNames - schema names of countries to use
      Returns:
      this same LotlFetchingProperties instance
    • setCountryNamesToIgnore

      public LotlFetchingProperties setCountryNamesToIgnore (String... countryNamesToIgnore)
      Adds schema name (usually two letters) of a country which shall be ignored during LOTL fetching.

      This method cannot be used together with setCountryNames(String...).

      If no schema names are added or ignored, all country specific LOTL files will be used.

      Most of the country names are present in LotlCountryCodeConstants class.

      Parameters:
      countryNamesToIgnore - countries to ignore
      Returns:
      this same LotlFetchingProperties instance
    • getCacheStalenessInMilliseconds

      public long getCacheStalenessInMilliseconds()
      Get the cache staleness threshold value in milliseconds.
      Returns:
      a set cache staleness in milliseconds.
    • setCacheStalenessInMilliseconds

      public LotlFetchingProperties setCacheStalenessInMilliseconds (long stalenessInMillis)
      Sets the allowed staleness of cached EU trusted list entries in milliseconds.

      This value determines how long the cached EU trusted lists certificates will be considered valid to be used in the signatures validation if they are not updated. The cached entries are attempted to be updated regularly according to setRefreshIntervalCalculator(LongUnaryOperator) configuration. If the update fails for some reason and the configured staleness threshold for the cached entry is eventually reached then the IOnFailingCountryLotlData strategy instance provided in the LotlFetchingProperties(IOnFailingCountryLotlData) will be invoked.

      The default value is 24 hours (24 * 60 * 60 * 1000 milliseconds).

      You can set this property to positive infinity in order to never consider the certificates stale and to keep using them in validation even if they are not updated. Consider updating the setRefreshIntervalCalculator(LongUnaryOperator) to return static value in this case though.

      See IOnFailingCountryLotlData for more details.

      Parameters:
      stalenessInMillis - the staleness time in milliseconds
      Returns:
      this same LotlFetchingProperties instance
    • getRefreshIntervalCalculator

      public LongUnaryOperator getRefreshIntervalCalculator()
      Gets the calculation function for the cache refresh interval.

      This function will be used to determine the refresh interval based on the staleness time. By default, it takes 70% of the staleness time as the refresh interval.

      Returns:
      a function that takes the staleness time in milliseconds and returns the refresh interval in milliseconds.
    • setRefreshIntervalCalculator

      public LotlFetchingProperties setRefreshIntervalCalculator (LongUnaryOperator refreshIntervalCalculator)
      Sets a custom cache refresh timer function. This function will be used to determine the refresh interval based on the staleness time.

      By default, it takes 23% of the staleness time as the refresh interval. So if the staleness time is 24 hours, the refresh interval will be set to 5.52 hours.

      Parameters:
      refreshIntervalCalculator - a function that takes the staleness time in milliseconds and returns the refresh interval in milliseconds.
      Returns:
      this same LotlFetchingProperties instance
    • getOnCountryFetchFailureStrategy

      public IOnFailingCountryLotlData getOnCountryFetchFailureStrategy()
      Gets the strategy to be used when fetching a country specific LOTL fails.
      Returns:
      the strategy to be used when fetching a country specific LOTL fails
    • setServiceTypes

      public LotlFetchingProperties setServiceTypes (String... serviceType)
      Adds service type identifier which shall be used during country specific LOTL fetching.

      If no service type identifiers are added, all service types from ServiceTypeIdentifiersConstants will be used.

      Only values supported by this logic are predefined in ServiceTypeIdentifiersConstants.

      Parameters:
      serviceType - service type identifier as a String
      Returns:
      this same LotlFetchingProperties instance