NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::security::v2::CertificateCache Class Reference

Represents a container for verified certificates. More...

#include <certificate-cache.hpp>

Inheritance diagram for ndn::security::v2::CertificateCache:
Collaboration diagram for ndn::security::v2::CertificateCache:

Public Member Functions

 CertificateCache (const time::nanoseconds &maxLifetime=getDefaultLifetime())
 Create an object for certificate cache. More...
 
void insert (const Certificate &cert)
 Insert certificate into cache. More...
 
void clear ()
 Remove all certificates from cache. More...
 
const Certificatefind (const Name &certPrefix) const
 Get certificate given key name. More...
 
const Certificatefind (const Interest &interest) const
 Find certificate given interest. More...
 

Static Public Member Functions

static time::nanoseconds getDefaultLifetime ()
 

Detailed Description

Represents a container for verified certificates.

A certificate is removed no later than its NotAfter time, or maxLifetime after it has been added to the cache.

Definition at line 43 of file certificate-cache.hpp.

Constructor & Destructor Documentation

◆ CertificateCache()

ndn::security::v2::CertificateCache::CertificateCache ( const time::nanoseconds maxLifetime = getDefaultLifetime())
explicit

Create an object for certificate cache.

Parameters
maxLifetimethe maximum time that certificates could live inside cache (default: 1 hour)

Definition at line 37 of file certificate-cache.cpp.

Member Function Documentation

◆ insert()

void ndn::security::v2::CertificateCache::insert ( const Certificate cert)

Insert certificate into cache.

The inserted certificate will be removed no later than its NotAfter time, or maxLifetime defined during cache construction.

Parameters
certthe certificate packet.

Definition at line 45 of file certificate-cache.cpp.

References ndn::Data::getName(), ndn::security::ValidityPeriod::getPeriod(), ndn::security::v2::Certificate::getValidityPeriod(), NDN_LOG_DEBUG, ndn::time::system_clock::now(), and ndn::time::toIsoString().

Referenced by ndn::security::v2::CertificateStorage::cacheUnverifiedCert(), and ndn::security::v2::CertificateStorage::cacheVerifiedCert().

◆ clear()

void ndn::security::v2::CertificateCache::clear ( )

Remove all certificates from cache.

Definition at line 61 of file certificate-cache.cpp.

Referenced by ndn::security::v2::CertificateStorage::resetVerifiedCerts().

◆ find() [1/2]

const Certificate * ndn::security::v2::CertificateCache::find ( const Name certPrefix) const

Get certificate given key name.

Parameters
certPrefixCertificate prefix for searching the certificate.
Returns
The found certificate, nullptr if not found.
Note
The returned value may be invalidated after next call to one of find methods.

Definition at line 67 of file certificate-cache.cpp.

References ndn::Name::isPrefixOf(), NDN_LOG_INFO, and ndn::Name::size().

Referenced by ndn::security::v2::CertificateBundleFetcher::doFetch(), ndn::security::v2::CertificateFetcher::fetch(), ndn::security::v2::CertificateStorage::findTrustedCert(), and ndn::security::v2::CertificateStorage::isCertKnown().

◆ find() [2/2]

const Certificate * ndn::security::v2::CertificateCache::find ( const Interest interest) const

Find certificate given interest.

Parameters
interestThe input interest packet.
Returns
The found certificate that matches the interest, nullptr if not found.
Note
The returned value may be invalidated after next call to one of find methods.

Definition at line 80 of file certificate-cache.cpp.

References ndn::Interest::getName(), ndn::Name::isPrefixOf(), ndn::Interest::matchesData(), NDN_LOG_INFO, ndn::time::system_clock::now(), and ndn::Name::size().

◆ getDefaultLifetime()

time::nanoseconds ndn::security::v2::CertificateCache::getDefaultLifetime ( )
static

Definition at line 32 of file certificate-cache.cpp.


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