#include <SimpleCRLCache.h>
This class is typically associated with short-lived mediators at run-time (then reused as necessary with different mediator instances).
This cache will grow without bound (aside from periodic removal of stale CRLs). In typical usage the path builder populates the cache. For cases where tighter cache control is required, custom implementations of the appropriate interfaces should be developed.
TSP-enforcing: No
Definition at line 41 of file SimpleCRLCache.h.
Public Member Functions | |
SimpleCRLCache (void) | |
virtual | ~SimpleCRLCache (void) |
void | Initialize (void) |
void | GetCRLs (const CPKIFCertificatePtr &cert, CPKIFCRLList &crlList, PKIInfoSource source=ALL) |
void | GetCRLs (std::vector< CPKIFCRLPtr > &v) |
void | GetCRLs (const CPKIFCertificatePtr &cert, CPKIFCRLList &crlList, PKIInfoSource source, CPKIFPathSettingsPtr &ps) |
void | AddCRL (const CPKIFCRLPtr &crl, const CPKIFGeneralNamePtr &dp) |
void | Clear () |
int | size () |
void | SetAutoCleanup (bool on, unsigned long interval=3600000) |
void | WriteCRLsToDirectory (const char *path) |
void | ReadCRLsFromDirectory (const char *path) |
Friends | |
struct | SimpleCRLCacheImpl |
SimpleCRLCache::SimpleCRLCache | ( | void | ) |
Interface: External
This function creates and initializes a SimpleCRLCache objects
Definition at line 123 of file SimpleCRLCache.cpp.
References LOG_STRING_DEBUG, and TOOLKIT_SR_SIMPLECRLCACHE.
SimpleCRLCache::~SimpleCRLCache | ( | void | ) | [virtual] |
Interface: External
This function destroys SimpleCRLCache objects
Definition at line 140 of file SimpleCRLCache.cpp.
void SimpleCRLCache::Initialize | ( | void | ) | [virtual] |
Interface: External
This function initializes an instance for use in a collection of IPKIFColleague objects held by a mediator
Reimplemented from IPKIFColleague.
Definition at line 178 of file SimpleCRLCache.cpp.
References LOG_STRING_DEBUG, and TOOLKIT_SR_SIMPLECRLCACHE.
void SimpleCRLCache::GetCRLs | ( | const CPKIFCertificatePtr & | cert, | |
CPKIFCRLList & | crlList, | |||
PKIInfoSource | source = ALL | |||
) | [virtual] |
Interface: External
This function will search the cache and return all CRLs issued by the issuer of the certificate or matching a distribution point in the certificate. The function simply returns without searching when source is equal to REMOTE
cert | [in] Pointer to a certificate for which revocation status is to be checked |
crlList | [out] Reference to a CRL list to receive CRLs that may be associated with the specified certificate |
source | [in] PKIInfoSource indicating the locations to search for CRLs |
Implements IPKIFCRLRepository.
Definition at line 191 of file SimpleCRLCache.cpp.
References CollectNamesFromCRLDP(), COMMON_INVALID_INPUT, CPKIFGeneralName::DIRECTORYNAME, FormatErrorMessage(), LOG_STRING_DEBUG, PKIFENUMS::REMOTE, GottaMatch< T >::SetRHS(), and TOOLKIT_SR_SIMPLECRLCACHE.
Referenced by GetCRLs().
void SimpleCRLCache::GetCRLs | ( | std::vector< CPKIFCRLPtr > & | v | ) |
Interface: External
This function comes returns a vector containing pointers to crls. Applications seeking to obtain all crls in SimpleCRLCache should use this function.
v | [in] std::vector which will contain the retrieved crl pointers |
Definition at line 607 of file SimpleCRLCache.cpp.
void SimpleCRLCache::GetCRLs | ( | const CPKIFCertificatePtr & | cert, | |
CPKIFCRLList & | crlList, | |||
PKIInfoSource | source, | |||
CPKIFPathSettingsPtr & | ps | |||
) | [virtual] |
Interface: External
This function appends pointers to CRLs that may be applicable to the certificate identified by cert to crlList. This function does not ensure that all CRLs are applicable to the specified certificate.
Reimplemented from IPKIFCRLRepository.
Definition at line 654 of file SimpleCRLCache.cpp.
References GetCRLs(), and CRLCoversTimeOfInterest::SetTimeOfInterest().
void SimpleCRLCache::AddCRL | ( | const CPKIFCRLPtr & | crl, | |
const CPKIFGeneralNamePtr & | dp | |||
) | [virtual] |
Interface: External
This class takes a pointer to a CRL and an optional distribution point. If provided, the distribution point value is used to provide an alternative to issuer distinguished name for locating the CRL in the in-memory cache. If the CRL is not successfully added no error is returned. (The lack of an error return is due to the intended use of this class, i.e. as a non-critical facilitator of efficient path building). Older CRLs present in the store are replaced by newer CRLs
crl | [in] Pointer to the CRL being added to the CRL store |
dp | [in] Pointer to a GeneralName identifying the distribution point of the CRL |
Implements IPKIFCRLRepositoryUpdate.
Definition at line 360 of file SimpleCRLCache.cpp.
References LOG_STRING_DEBUG, GottaMatch< T >::SetRHS(), and TOOLKIT_SR_SIMPLECRLCACHE.
Referenced by ReadCRLsFromDirectory().
void SimpleCRLCache::Clear | ( | ) |
Interface: External
This function may be used to empty the cache
Definition at line 316 of file SimpleCRLCache.cpp.
References LOG_STRING_DEBUG, and TOOLKIT_SR_SIMPLECRLCACHE.
int SimpleCRLCache::size | ( | ) |
Interface: External
This function returns an integer containing the number of items in the CRL cache
Definition at line 155 of file SimpleCRLCache.cpp.
References COMMON_INVALID_INPUT, and TOOLKIT_CACHE.
void SimpleCRLCache::SetAutoCleanup | ( | bool | on, | |
unsigned long | interval = 3600000 | |||
) |
Interface: External
When auto-cleanup s enabled, the cache will automatically review the contents of the cache periodically to remove CRLs that have a nextUpdate time in the past
on | [in] Boolean value set to true when auto-cleanup should be enabled and false when it should be disabled |
interval | [in] Unsigned long value indicating the number of milliseconds to use as the period for inspecting the cache to remove old items |
Definition at line 333 of file SimpleCRLCache.cpp.
References LOG_STRING_DEBUG, and TOOLKIT_SR_SIMPLECRLCACHE.
void SimpleCRLCache::WriteCRLsToDirectory | ( | const char * | path | ) |
Interface: External
This function is used to read CRLs from a directory and add them to the this SimpleCRLCache object
CPKIFCacheException(COMMON_UNKNOWN_ERROR) |
path | [in] Path to the directory to where CRLs will be written to |
Definition at line 420 of file SimpleCRLCache.cpp.
References COMMON_UNKNOWN_ERROR, and RAISE_CACHE_EXCEPTION.
void SimpleCRLCache::ReadCRLsFromDirectory | ( | const char * | path | ) |
Interface: External
This function is used to write all the CRLs in this SimpleCRLCache object to a directory specified by the path parameter
NOTE: This function is intended for CRL files only. A possible buffer overflow might occur if the directory contains very large file.
CPKIFCacheException(COMMON_INVALID_INPUT) | ||
CPKIFCacheException(COMMON_UNKNOWN_ERROR) |
path | [in] Path to the directory from where CRLs will be read |
Definition at line 484 of file SimpleCRLCache.cpp.
References AddCRL(), COMMON_INVALID_INPUT, COMMON_UNKNOWN_ERROR, RAISE_CACHE_EXCEPTION, TOOLKIT_SR_SIMPLECRLCACHE, and TOOLKIT_UTILS.
friend struct SimpleCRLCacheImpl [friend] |
Definition at line 44 of file SimpleCRLCache.h.