Project

General

Profile

Actions

Task #3317

closed

Task #3289: Validator Refactoring

Design and Implement validator::CertificateCache

Added by Qiuhan Ding over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Category:
Security
Target version:
Start date:
11/04/2015
Due date:
% Done:

100%

Estimated time:

Description

One Module of KeyManager which manages verified certificates for Validator.

The certificates inside the cache would have an expire time and there is a maximum life time for all certificates.

Certificates can be searched by key name and interest

const time::nanoseconds DEFAULT_LIFE_TIME(time::seconds(3600));

class CertificateCache
{
public:
  // @brief Create an object for certificate cache.
  explicit
  CertificateCache(const time::nanoseconds& lifeTime = DEFAULT_LIFE_TIME);

  ~CertificateCache();

  // @brief Insert certificate into cache.
  void
  insert(shared_ptr<const Data> cert, const time::system_clock::TimePoint& expireTime);

  // @brief Get certificate given key name. The method will also remove outdated certificate entries.
  shared_ptr<const Data>
  find(const Name& keyName);

  // @brief Find certificate given interest. The method will also remove outdated certificate entries.
  shared_ptr<const Data>
  find(const Interest& interest);

private:
  // @brief Remove all outdated certificate entries.
  void
  refresh();

private:
  CertIndex m_certs;
  time::nanoseconds m_lifeTime; 
};
Actions

Also available in: Atom PDF