Class OCSPResponsesCache


  • public class OCSPResponsesCache
    extends OCSPCacheBase
    OCSP responses cache: in memory with disk persistence.
    Author:
    K. Benedyczak
    • Constructor Summary

      Constructors 
      Constructor Description
      OCSPResponsesCache​(long maxTtl, java.io.File diskPath, java.lang.String prefix)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addToCache​(java.lang.String key, OCSPResponseStructure fullResp, org.bouncycastle.cert.ocsp.SingleResp singleResp)  
      void clearMemoryCache()  
      java.lang.String createResponseKey​(java.security.cert.X509Certificate toCheckCert, java.security.cert.X509Certificate issuerCert)  
      org.bouncycastle.cert.ocsp.SingleResp getCachedResp​(java.lang.String responseKey, OCSPClientImpl client, java.security.cert.X509Certificate toCheckCert, java.security.cert.X509Certificate issuerCert)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OCSPResponsesCache

        public OCSPResponsesCache​(long maxTtl,
                                  java.io.File diskPath,
                                  java.lang.String prefix)
        Parameters:
        maxTtl - maximum time after each cached response expires. Negative for no cache at all, 0 for no limit (i.e. caching time will be only controlled by the OCSP response validity period). In ms.
        diskPath - if not null, cached responses will be stored on disk.
        prefix - used if disk cache is enabled, as a common prefix for all files created in the cache directory.
    • Method Detail

      • getCachedResp

        public org.bouncycastle.cert.ocsp.SingleResp getCachedResp​(java.lang.String responseKey,
                                                                   OCSPClientImpl client,
                                                                   java.security.cert.X509Certificate toCheckCert,
                                                                   java.security.cert.X509Certificate issuerCert)
                                                            throws java.io.IOException
        Parameters:
        responseKey - response key
        client - OCSP client
        toCheckCert - mandatory certificate to be checked
        issuerCert - mandatory certificate of the toCheckCert issuer
        Returns:
        The cached response if available, null otherwise.
        Throws:
        java.io.IOException - IO exception
      • createResponseKey

        public java.lang.String createResponseKey​(java.security.cert.X509Certificate toCheckCert,
                                                  java.security.cert.X509Certificate issuerCert)
      • addToCache

        public void addToCache​(java.lang.String key,
                               OCSPResponseStructure fullResp,
                               org.bouncycastle.cert.ocsp.SingleResp singleResp)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • clearMemoryCache

        public void clearMemoryCache()