NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
pib-impl.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2021 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  */
21 
22 #ifndef NDN_CXX_SECURITY_PIB_PIB_IMPL_HPP
23 #define NDN_CXX_SECURITY_PIB_PIB_IMPL_HPP
24 
27 
28 #include <set>
29 
30 namespace ndn {
31 namespace security {
32 namespace pib {
33 
40 class PibImpl : noncopyable
41 {
42 public:
49  class Error : public std::runtime_error
50  {
51  public:
52  using std::runtime_error::runtime_error;
53  };
54 
55 public:
56  virtual
57  ~PibImpl() = default;
58 
59 public: // TpmLocator management
65  virtual void
66  setTpmLocator(const std::string& tpmLocator) = 0;
67 
71  virtual std::string
72  getTpmLocator() const = 0;
73 
74 public: // Identity management
81  virtual bool
82  hasIdentity(const Name& identity) const = 0;
83 
92  virtual void
93  addIdentity(const Name& identity) = 0;
94 
103  virtual void
104  removeIdentity(const Name& identity) = 0;
105 
109  virtual void
110  clearIdentities() = 0;
111 
115  virtual std::set<Name>
116  getIdentities() const = 0;
117 
125  virtual void
126  setDefaultIdentity(const Name& identityName) = 0;
127 
134  virtual Name
135  getDefaultIdentity() const = 0;
136 
137 public: // Key management
143  virtual bool
144  hasKey(const Name& keyName) const = 0;
145 
158  virtual void
159  addKey(const Name& identity, const Name& keyName, span<const uint8_t> key) = 0;
160 
166  virtual void
167  removeKey(const Name& keyName) = 0;
168 
175  virtual Buffer
176  getKeyBits(const Name& keyName) const = 0;
177 
186  virtual std::set<Name>
187  getKeysOfIdentity(const Name& identity) const = 0;
188 
194  virtual void
195  setDefaultKeyOfIdentity(const Name& identity, const Name& keyName) = 0;
196 
202  virtual Name
203  getDefaultKeyOfIdentity(const Name& identity) const = 0;
204 
205 public: // Certificate Management
212  virtual bool
213  hasCertificate(const Name& certName) const = 0;
214 
227  virtual void
228  addCertificate(const Certificate& certificate) = 0;
229 
237  virtual void
238  removeCertificate(const Name& certName) = 0;
239 
247  virtual Certificate
248  getCertificate(const Name& certName) const = 0;
249 
258  virtual std::set<Name>
259  getCertificatesOfKey(const Name& keyName) const = 0;
260 
266  virtual void
267  setDefaultCertificateOfKey(const Name& keyName, const Name& certName) = 0;
268 
274  virtual Certificate
275  getDefaultCertificateOfKey(const Name& keyName) const = 0;
276 };
277 
278 } // namespace pib
279 } // namespace security
280 } // namespace ndn
281 
282 #endif // NDN_CXX_SECURITY_PIB_PIB_IMPL_HPP
represents a non-semantic error
Definition: pib-impl.hpp:49
virtual void removeIdentity(const Name &identity)=0
Remove an identity and related keys and certificates.
Copyright (c) 2011-2015 Regents of the University of California.
virtual void removeKey(const Name &keyName)=0
Remove a key with keyName and related certificates.
virtual void removeCertificate(const Name &certName)=0
Remove a certificate with name certName.
virtual ~PibImpl()=default
virtual void setDefaultCertificateOfKey(const Name &keyName, const Name &certName)=0
Set a cert with name certName as the default of a key with keyName.
virtual bool hasIdentity(const Name &identity) const =0
Check the existence of an identity.
virtual Certificate getCertificate(const Name &certName) const =0
Get a certificate with name certName.
virtual void setDefaultIdentity(const Name &identityName)=0
Set an identity with name identityName as the default identity.
virtual bool hasKey(const Name &keyName) const =0
Check the existence of a key with keyName.
virtual bool hasCertificate(const Name &certName) const =0
Check the existence of a certificate with name certName.
virtual std::string getTpmLocator() const =0
Get TPM Locator.
virtual Certificate getDefaultCertificateOfKey(const Name &keyName) const =0
virtual void addIdentity(const Name &identity)=0
Add an identity.
virtual std::set< Name > getCertificatesOfKey(const Name &keyName) const =0
Get a list of certificate names of a key with id keyName.
virtual void clearIdentities()=0
Erasing all certificates, keys, and identities.
Represents an absolute name.
Definition: name.hpp:41
virtual Name getDefaultIdentity() const =0
Get the default identity.
virtual void addCertificate(const Certificate &certificate)=0
Add a certificate.
virtual void setTpmLocator(const std::string &tpmLocator)=0
Set the corresponding TPM information to tpmLocator.
virtual std::set< Name > getIdentities() const =0
Get the name of all the identities.
virtual Name getDefaultKeyOfIdentity(const Name &identity) const =0
virtual void addKey(const Name &identity, const Name &keyName, span< const uint8_t > key)=0
Add a key.
virtual void setDefaultKeyOfIdentity(const Name &identity, const Name &keyName)=0
Set an key with keyName as the default key of an identity with name identity.
General-purpose automatically managed/resized buffer.
Definition: buffer.hpp:41
virtual std::set< Name > getKeysOfIdentity(const Name &identity) const =0
Get all the key names of an identity with name identity.
Abstract class of PIB implementation.
Definition: pib-impl.hpp:40
virtual Buffer getKeyBits(const Name &keyName) const =0
Get the key bits of a key with name keyName.