SimpleCertCache Class Reference

#include <SimpleCertCache.h>

Inheritance diagram for SimpleCertCache:

Inheritance graph
[legend]
Collaboration diagram for SimpleCertCache:

Collaboration graph
[legend]

List of all members.


Detailed Description

The SimpleCertCache class provides a very simple implementation of the IPKIFCertRepository and IPKIFCertRepositoryUpdate interfaces using a std::vector to provide an in-memory cache alternative.

Instances of SimpleCertCache may be associated with short-lived mediators at run-time (then reused as necessary with different mediator instances).

This cache will grow without bound. In typical usage, the path builder populates the cache with intermediate CA certificates only so size is not a problem. For cases where tighter cache control is required, custom implementations of the appropriate interfaces should be developed.

TSP-enforcing: No

Definition at line 37 of file SimpleCertCache.h.


Public Member Functions

 SimpleCertCache (void)
virtual ~SimpleCertCache (void)
void Initialize (void)
void GetCertificates (const CPKIFNamePtr &subDN, CPKIFCertificateList &certList, PKIInfoSource source=ALL)
void GetCertificates (const CPKIFNamePtr &subDN, CPKIFCertificateNodeList &certNodeList, PKIInfoSource source=ALL)
void GetCertificates (const CPKIFCertificatePtr &cert, CPKIFCertificateList &certList, PKIInfoSource source=ALL, PathBuildingDirection pbd=PBD_FORWARD)
void GetCertificates (const CPKIFCertificatePtr &cert, CPKIFCertificateNodeList &certNodeList, PKIInfoSource source=ALL, PathBuildingDirection pbd=PBD_FORWARD)
void AddCertificate (CertType certType, const CPKIFCertificatePtr &cert)
void AddCertificate (CertType certType, const CPKIFCertificateNodeEntryPtr &certNode)
void GetCertificates (std::vector< CPKIFCertificatePtr > &v)
void WriteCertsToDirectory (const char *path)
void ReadCertsFromDirectory (const char *path)
PKIInfoSource GetSourceType ()
void FindCertificates (IPKIFSearchCriteria *searchCriteria, CPKIFCertificateList &certList, PKIInfoSource source=ALL)
void FindKeys (IPKIFSearchCriteria *searchCriteria, IPKIFNameAndKeyList &keyList, PKIInfoSource source=ALL)
void Clear ()
int size ()

Constructor & Destructor Documentation

SimpleCertCache::SimpleCertCache ( void   ) 

Interface: External

This function creates and initializes a SimpleCertCache object

Returns:
None

Definition at line 320 of file SimpleCertCache.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_SR_SIMPLECERTCACHE.

SimpleCertCache::~SimpleCertCache ( void   )  [virtual]

Interface: External

This function destroys SimpleCertCache object

Returns:
None

Definition at line 332 of file SimpleCertCache.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_SR_SIMPLECERTCACHE.


Member Function Documentation

void SimpleCertCache::Initialize ( void   )  [virtual]

Interface: External

This function initializes an instance for use in a collection of IPKIFColleague objects held by a mediator

Returns:
None

Reimplemented from IPKIFColleague.

Definition at line 348 of file SimpleCertCache.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_SR_SIMPLECERTCACHE.

void SimpleCertCache::GetCertificates ( const CPKIFNamePtr &  subDN,
CPKIFCertificateList certList,
PKIInfoSource  source = ALL 
) [virtual]

Interface: External

This function comes returns a list containing pointers to certificates. Applications seeking to obtain a certificate should use this function.The function simply returns without searching when source is equal to REMOTE.

This function does not remove certificates from the outbound lists. Thus, following a call to this function the list may contain certificates other than those with subject distinguished names matching the subDN parameter value.

Returns:
None
Parameters:
subDN  [in] Pointer to a distinguished name corresponding to the subject distinguished name in the desired certificates
certList  [out] List of pointers to certificates with a subject distinguished name equal to the value passed via the subDN parameter
source  [in] PKIInfoSource value indicating the types of locations that should be searched for certificates

Implements IPKIFCertRepository.

Definition at line 403 of file SimpleCertCache.cpp.

References LOG_STRING_DEBUG, PKIFENUMS::PBD_FORWARD, GottaMatch< T >::SetRHS(), and TOOLKIT_SR_SIMPLECERTCACHE.

Referenced by GetCertificates().

void SimpleCertCache::GetCertificates ( const CPKIFNamePtr &  subDN,
CPKIFCertificateNodeList certNodeList,
PKIInfoSource  source = ALL 
) [virtual]

Interface: External

This function returns a list of pointers to certificate nodes. The function is used by the path builder as a means of maintaining information about the original source of the certificate. The function simply returns without searching when source is equal to REMOTE.

This function does not remove certificates from the outbound lists. Thus, following a call to this function the list may contain certificates other than those with subject distinguished names matching the subDN parameter value.

Returns:
None
Parameters:
subDN  [in] Pointer to a distinguished name corresponding to the subject distinguished name in the desired certificates
certNodeList  [out] List of pointers to certificate node objects containing certificates with a subject distinguished name equal to the value passed via the subDN parameter
source  [in] PKIInfoSource value indicating the types of locations that should be searched for certificates

Reimplemented from IPKIFCertRepository.

Definition at line 636 of file SimpleCertCache.cpp.

References PKIFENUMS::PBD_FORWARD.

void SimpleCertCache::GetCertificates ( const CPKIFCertificatePtr &  cert,
CPKIFCertificateList certList,
PKIInfoSource  source = ALL,
PathBuildingDirection  pbd = PBD_FORWARD 
) [virtual]

Interface: External

This function comes returns a list containing pointers to certificates. Applications seeking to obtain a certificate should use this function.The function simply returns without searching when source is equal to REMOTE.

This function does not remove certificates from the outbound lists. Thus, following a call to this function the list may contain certificates other than those with subject distinguished names matching the subDN parameter value.

Returns:
None
Parameters:
cert  [in] Pointer to a distinguished name corresponding to the subject distinguished name in the desired certificates
certList  [out] List of pointers to certificates with a subject distinguished name equal to the value passed via the subDN parameter
source  [in] PKIInfoSource value indicating the types of locations that should be searched for certificates
pbd  [in] enum indicating build direction

Reimplemented from IPKIFCertRepository.

Definition at line 479 of file SimpleCertCache.cpp.

References GetCertificates(), PKIFENUMS::PBD_FORWARD, PKIFENUMS::PBD_REVERSE, and GottaMatch< T >::SetRHS().

void SimpleCertCache::GetCertificates ( const CPKIFCertificatePtr &  cert,
CPKIFCertificateNodeList certNodeList,
PKIInfoSource  source = ALL,
PathBuildingDirection  pbd = PBD_FORWARD 
) [virtual]

Interface: External

This function comes returns a list containing pointers to certificates. Applications seeking to obtain a certificate should use this function.The function simply returns without searching when source is equal to REMOTE.

This function does not remove certificates from the outbound lists. Thus, following a call to this function the list may contain certificates other than those with subject distinguished names matching the subDN parameter value.

Returns:
None
Parameters:
cert  [in] Pointer to a distinguished name corresponding to the subject distinguished name in the desired certificates
certNodeList  [out] List of pointers to certificates with a subject distinguished name equal to the value passed via the subDN parameter
source  [in] PKIInfoSource value indicating the types of locations that should be searched for certificates
pbd  [in] enum indicating build direction

Reimplemented from IPKIFCertRepository.

Definition at line 531 of file SimpleCertCache.cpp.

References PKIFENUMS::PBD_FORWARD, and PKIFENUMS::PBD_REVERSE.

void SimpleCertCache::AddCertificate ( CertType  certType,
const CPKIFCertificatePtr &  cert 
) [virtual]

Interface: External

This function accepts a certificate. Certificates already present in the cache are ignored

Returns:
None
Parameters:
certType  [in] CertType value indicating the type of certificate being added
cert  [in] Pointer to the certificate being added to the cache

Implements IPKIFCertRepositoryUpdate.

Definition at line 559 of file SimpleCertCache.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_SR_SIMPLECERTCACHE.

Referenced by ReadCertsFromDirectory().

void SimpleCertCache::AddCertificate ( CertType  certType,
const CPKIFCertificateNodeEntryPtr certNode 
) [virtual]

Interface: External

This function accepts a certificate node. This function is used by the path builder as a means of maintaining information about the original source of the certificate. Certificates already present in the cache are ignored.

Returns:
None
Parameters:
certType  [in] CertType value indicating the type of certificate being added
certNode  [in] Pointer to the certificate node being added to the cache

Reimplemented from IPKIFCertRepositoryUpdate.

Definition at line 586 of file SimpleCertCache.cpp.

References LOG_STRING_DEBUG, GottaMatch< T >::SetRHS(), and TOOLKIT_SR_SIMPLECERTCACHE.

void SimpleCertCache::GetCertificates ( std::vector< CPKIFCertificatePtr > &  v  ) 

Interface: External

This function comes returns a vector containing pointers to certificates. Applications seeking to obtain a certificate should use this function.

Returns:
None
Parameters:
v  [in] std::vector which will contain the retrived certificate pointers

Definition at line 779 of file SimpleCertCache.cpp.

void SimpleCertCache::WriteCertsToDirectory ( const char *  path  ) 

Interface: External

This function is used to write all the certs in this SimpleCertCache object to a directory specified by the path parameter

Returns:
None
Exceptions:
CPKIFCacheException(COMMON_UNKNOWN_ERROR) 
Parameters:
path  [in] Path to the directory to where certs will be written to

Definition at line 657 of file SimpleCertCache.cpp.

References COMMON_UNKNOWN_ERROR, and RAISE_CACHE_EXCEPTION.

void SimpleCertCache::ReadCertsFromDirectory ( const char *  path  ) 

Interface: External

This function is used to read certs from a directory specified by the path parameter and add the certs that were read to this SimpleCertCache object.

NOTE: This function is intended for certificate files only. A possible buffer overflow might occur if the directory contains very large file.

Returns:
None
Exceptions:
CPKIFCacheException(COMMON_INVALID_INPUT) 
CPKIFCacheException(COMMON_UNKNOWN_ERROR) 
Parameters:
path  [in] Path to the directory from where certs will be read

Definition at line 707 of file SimpleCertCache.cpp.

References AddCertificate(), PKIFENUMS::CA, COMMON_INVALID_INPUT, COMMON_UNKNOWN_ERROR, RAISE_CACHE_EXCEPTION, TOOLKIT_SR_SIMPLECERTCACHE, and TOOLKIT_UTILS.

PKIInfoSource SimpleCertCache::GetSourceType (  )  [inline, virtual]

Implements IPKIFCertRepository.

Definition at line 62 of file SimpleCertCache.h.

References PKIFENUMS::LOCAL.

void SimpleCertCache::FindCertificates ( IPKIFSearchCriteria searchCriteria,
CPKIFCertificateList certList,
PKIInfoSource  source = ALL 
) [virtual]

Implements IPKIFCertSearch.

Definition at line 791 of file SimpleCertCache.cpp.

References FindKeys().

void SimpleCertCache::FindKeys ( IPKIFSearchCriteria searchCriteria,
IPKIFNameAndKeyList keyList,
PKIInfoSource  source = ALL 
) [virtual]

void SimpleCertCache::Clear (  ) 

Interface: External

This function may be used to empty the cache

Returns:
None

Definition at line 359 of file SimpleCertCache.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_SR_SIMPLECERTCACHE.

int SimpleCertCache::size (  ) 

Interface: External

This function returns an integer representing the number of certificates stored in the associated cache

Returns:
An integer representing the number of certificates stored in the associated cache

Definition at line 375 of file SimpleCertCache.cpp.

References COMMON_INVALID_INPUT, and TOOLKIT_CACHE.


The documentation for this class was generated from the following files:

Generated on Mon Nov 15 11:21:09 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6