certificate-store.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_CERTIFICATE_STORE_HPP
23 #define NLSR_CERTIFICATE_STORE_HPP
24 
25 #include "../common.hpp"
26 #include "../test-access-control.hpp"
27 
28 #include <ndn-cxx/interest.hpp>
29 #include <ndn-cxx/security/v2/certificate.hpp>
30 
31 namespace nlsr {
32 namespace security {
33 
42 {
43 public:
44  void
45  insert(const ndn::security::v2::Certificate& certificate)
46  {
47  m_certificates[certificate.getKeyName()] = certificate;
48  }
49 
50  const ndn::security::v2::Certificate*
51  find(const ndn::Name keyName)
52  {
53  CertMap::iterator it = m_certificates.find(keyName);
54 
55  if (it != m_certificates.end()) {
56  return &it->second;
57  }
58 
59  return nullptr;
60  }
61 
63  void
64  clear()
65  {
66  m_certificates.clear();
67  }
68 
69 private:
70  typedef std::map<ndn::Name, ndn::security::v2::Certificate> CertMap;
71  CertMap m_certificates;
72 };
73 
74 } // namespace security
75 } // namespace nlsr
76 
77 #endif // NLSR_CERTIFICATE_STORE_HPP
Store certificates for names.
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
void insert(const ndn::security::v2::Certificate &certificate)
Copyright (c) 2014-2019, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
const ndn::security::v2::Certificate * find(const ndn::Name keyName)