Class CRLCacheImpl
java.lang.Object
se.swedenconnect.sigval.cert.validity.crl.impl.CRLCacheImpl
- All Implemented Interfaces:
CRLCache
CRL cache implementation. Two main functions allows retrieval of a CRL from this cache which adds the CRL to the
cache if not present, and a function for re-caching all CRLs on the cache. The latter function is meant to be called
periodically by a daemon process in the background
- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Field Summary
Fields inherited from interface se.swedenconnect.sigval.cert.validity.crl.CRLCache
DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT, LDAP_CONNECT_TIMEOUT, LDAP_CONTEXT_FACTORY, LDAP_READ_TIMEOUT
-
Constructor Summary
ConstructorsConstructorDescriptionCRLCacheImpl
(File cacheDataFolder, long recacheGracePeriod) Constructor for the CRL cache.CRLCacheImpl
(File cacheDataFolder, long recacheGracePeriod, CRLDataLoader crlDataLoader) Constructor for the CRL cache. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves a CRL from the CRL cache.getCRL
(org.bouncycastle.asn1.x509.CRLDistPoint crlDistributionPointExt) This function is a more practical use of the cache rather than asking for a particular cached URL.Returns the current list of cached CRL recordsvoid
recache()
Performs a re-cache of all cached CRL records.
-
Constructor Details
-
CRLCacheImpl
Constructor for the CRL cache.- Parameters:
cacheDataFolder
- the data folder used to store cache datarecacheGracePeriod
- time in milliseconds for the time after last cache instance when first re-cache will be attempted
-
CRLCacheImpl
Constructor for the CRL cache.- Parameters:
cacheDataFolder
- the data folder used to store cache datarecacheGracePeriod
- time in milliseconds for the time after last cache instance when first re-cache will be attemptedcrlDataLoader
- data loader for downloading CRL data or null to use default CRL data loader
-
-
Method Details
-
getCrlCacheRecords
Returns the current list of cached CRL records- Specified by:
getCrlCacheRecords
in interfaceCRLCache
- Returns:
- list of cached CRLs
-
getCRL
public CRLInfo getCRL(org.bouncycastle.asn1.x509.CRLDistPoint crlDistributionPointExt) throws IOException This function is a more practical use of the cache rather than asking for a particular cached URL. This function is however limited to the following specific usage policy:- Only distribution points with absent reason settings are accepted (Not limited to a subset of reasons)
- Only distribution points with absent crlIssuer are accepted (CRL must be issued by cert issuer)
- Both LDAP(S) and HTTP(S) sources are accepted
- If both LDAP and HTTP sources are present, HTTP is attempted first. LDAP will only be attempted if HTTP fails
- If several sources are present, only the first successful source will be cached
- Specified by:
getCRL
in interfaceCRLCache
- Parameters:
crlDistributionPointExt
- CRL distribution point extension- Returns:
- CRL
- Throws:
IOException
- on error to obtain the CRL from this extension
-
getCRL
Retrieves a CRL from the CRL cache. If the CRL is not in the cache or if the cached CRL is expired, then an attempt to download and cache the CRL is made.- Specified by:
getCRL
in interfaceCRLCache
- Parameters:
url
- the location of the CRL- Returns:
- cached or downloaded CRL
- Throws:
IOException
- if it is not possible to obtain a CRL from this location
-
recache
public void recache()Performs a re-cache of all cached CRL records. This method should be called by a daemon process periodically
-