certificate-store.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2022, The University of Memphis,
4  * Regents of the University of California,
5  * Arizona Board of Regents.
6  *
7  * This file is part of NLSR (Named-data Link State Routing).
8  * See AUTHORS.md for complete list of NLSR authors and contributors.
9  *
10  * NLSR is free software: you can redistribute it and/or modify it under the terms
11  * of the GNU General Public License as published by the Free Software Foundation,
12  * either version 3 of the License, or (at your option) any later version.
13  *
14  * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16  * PURPOSE. See the GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along with
19  * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef NLSR_CERTIFICATE_STORE_HPP
23 #define NLSR_CERTIFICATE_STORE_HPP
24 
25 #include "common.hpp"
26 #include "test-access-control.hpp"
27 #include "lsdb.hpp"
28 
29 #include <ndn-cxx/interest.hpp>
30 #include <ndn-cxx/mgmt/nfd/controller.hpp>
31 #include <ndn-cxx/security/certificate.hpp>
32 #include <ndn-cxx/security/validator-config.hpp>
33 
34 namespace nlsr {
35 class ConfParameter;
36 namespace security {
37 
46 {
47 public:
48  CertificateStore(ndn::Face& face, ConfParameter& confParam, Lsdb& lsdb);
49 
50  void
51  insert(const ndn::security::Certificate& certificate);
52 
63  const ndn::security::Certificate*
64  find(const ndn::Name& name) const;
65 
70  void
71  publishCertFromCache(const ndn::Name& keyName);
72 
73  void
74  afterFetcherSignalEmitted(const ndn::Data& lsaSegment);
75 
77  const ndn::security::Certificate*
78  findByKeyName(const ndn::Name& keyName) const;
79 
80  const ndn::security::Certificate*
81  findByCertName(const ndn::Name& certName) const;
82 
83  void
84  clear();
85 
86  void
87  setInterestFilter(const ndn::Name& prefix, const bool loopback = false);
88 
89  void
90  registerKeyPrefixes();
91 
92  void
93  onKeyInterest(const ndn::Name& name, const ndn::Interest& interest);
94 
95  void
96  onKeyPrefixRegSuccess(const ndn::Name& name);
97 
98  void
99  registrationFailed(const ndn::Name& name);
100 
101 private:
102  typedef std::map<ndn::Name, ndn::security::Certificate> CertMap;
103  CertMap m_certificates;
104  ndn::Face& m_face;
105  ConfParameter& m_confParam;
106  ndn::security::ValidatorConfig& m_validator;
107  ndn::util::signal::ScopedConnection m_afterSegmentValidatedConnection;
108 };
109 
110 } // namespace security
111 } // namespace nlsr
112 
113 #endif // NLSR_CERTIFICATE_STORE_HPP
A class to house all the configuration parameters for NLSR.
Store certificates for names.
const ndn::security::Certificate * find(const ndn::Name &name) const
Find a certificate.
void insert(const ndn::security::Certificate &certificate)
void afterFetcherSignalEmitted(const ndn::Data &lsaSegment)
CertificateStore(ndn::Face &face, ConfParameter &confParam, Lsdb &lsdb)
void publishCertFromCache(const ndn::Name &keyName)
Retrieves the chain of certificates from Validator's cache and store them in Nlsr's own CertificateSt...
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE