Class OCSPCache

  • All Implemented Interfaces:
    ManageableCache

    public class OCSPCache
    extends Object
    implements ManageableCache
    This is a cache to store OSCP responses against Certificate Serial Number since an OCSP response depends on the certificate. This is a singleton since more than one cache of this kind should not be allowed. This cache can be shared by many transports which need SSL validation through OCSP.
    • Method Detail

      • getCache

        public static OCSPCache getCache()
      • init

        public void init​(int size,
                         int delay)
        This lazy initializes the Cache with a CacheManager. If this method is not called, a cache manager will not be used.
        Parameters:
        size - max size of the cache
        delay - defines how frequently the CacheManager will be started
      • getNextCacheValue

        public ManageableCacheValue getNextCacheValue()
        This method is needed by the cache Manager to go through the cache entries to remove invalid values or to remove LRU cache values if the cache has reached its max size. Todo: Can move to an abstract class.
        Specified by:
        getNextCacheValue in interface ManageableCache
        Returns:
        next cache value of the cache.
      • getCacheSize

        public int getCacheSize()
        Specified by:
        getCacheSize in interface ManageableCache
        Returns:
        the current cache size (size of the hash map)
      • getCacheValue

        public org.bouncycastle.cert.ocsp.SingleResp getCacheValue​(BigInteger serialNumber)
      • setCacheValue

        public void setCacheValue​(BigInteger serialNumber,
                                  org.bouncycastle.cert.ocsp.SingleResp singleResp,
                                  org.bouncycastle.cert.ocsp.OCSPReq request,
                                  String serviceUrl)
      • removeCacheValue

        public void removeCacheValue​(BigInteger serialNumber)