31 const time::nanoseconds&
34 static time::nanoseconds lifetime = time::seconds(3600);
39 : m_certsByTime(m_certs.get<0>())
40 , m_certsByName(m_certs.get<1>())
41 , m_maxLifetime(maxLifetime)
50 if (notAfterTime < now) {
57 << time::duration_cast<time::seconds>(removalTime - now));
58 m_certs.insert(Entry(cert, removalTime));
71 if (certPrefix.
size() > 0 && certPrefix[-1].isImplicitSha256Digest()) {
72 NDN_LOG_INFO(
"Certificate search using name with the implicit digest is not yet supported");
74 auto itr = m_certsByName.lower_bound(certPrefix);
75 if (itr == m_certsByName.end() || !certPrefix.
isPrefixOf(itr->getCertName()))
84 NDN_LOG_DEBUG(
"Certificate search using ChildSelector is not supported, searching as if selector not specified");
86 if (interest.
getName().
size() > 0 && interest.
getName()[-1].isImplicitSha256Digest()) {
87 NDN_LOG_INFO(
"Certificate search using name with implicit digest is not yet supported");
91 for (
auto i = m_certsByName.lower_bound(interest.
getName());
94 const auto& cert = i->cert;
103 CertificateCache::refresh()
107 auto cIt = m_certsByTime.begin();
108 while (cIt != m_certsByTime.end() && cIt->removalTime < now) {
109 m_certsByTime.erase(cIt);
110 cIt = m_certsByTime.begin();
#define NDN_LOG_INFO(expression)
const Name & getName() const
Copyright (c) 2011-2015 Regents of the University of California.
The certificate following the certificate format naming convention.
ValidityPeriod getValidityPeriod() const
Get validity period of the certificate.
void clear()
Remove all certificates from cache.
represents an Interest packet
static time_point now() noexcept
const Certificate * find(const Name &certPrefix) const
Get certificate given key name.
int getChildSelector() const
Catch-all error for security policy errors that don't fit in other categories.
Represents a container for verified certificates.
#define NDN_LOG_INIT(name)
declare a log module
CertificateCache(const time::nanoseconds &maxLifetime=getDefaultLifetime())
Create an object for certificate cache.
#define NDN_LOG_DEBUG(expression)
std::pair< time::system_clock::TimePoint, time::system_clock::TimePoint > getPeriod() const
Get the stored validity period.
size_t size() const
Get number of components.
Represents an absolute name.
bool isPrefixOf(const Name &other) const
Check if this name is a prefix of another name.
bool matchesData(const Data &data) const
Check if Interest can be satisfied by data.
std::string toIsoString(const system_clock::TimePoint &timePoint)
Convert to the ISO string representation of the time (YYYYMMDDTHHMMSS,fffffffff)
static const time::nanoseconds & getDefaultLifetime()
const Name & getName() const
Get name.
void insert(const Certificate &cert)
Insert certificate into cache.