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-2018 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_SECURITY_PIB_PIB_IMPL_HPP
23 #define NDN_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 
159  virtual void
160  addKey(const Name& identity, const Name& keyName, const uint8_t* key, size_t keyLen) = 0;
161 
167  virtual void
168  removeKey(const Name& keyName) = 0;
169 
176  virtual Buffer
177  getKeyBits(const Name& keyName) const = 0;
178 
187  virtual std::set<Name>
188  getKeysOfIdentity(const Name& identity) const = 0;
189 
195  virtual void
196  setDefaultKeyOfIdentity(const Name& identity, const Name& keyName) = 0;
197 
203  virtual Name
204  getDefaultKeyOfIdentity(const Name& identity) const = 0;
205 
206 public: // Certificate Management
213  virtual bool
214  hasCertificate(const Name& certName) const = 0;
215 
228  virtual void
229  addCertificate(const v2::Certificate& certificate) = 0;
230 
238  virtual void
239  removeCertificate(const Name& certName) = 0;
240 
248  virtual v2::Certificate
249  getCertificate(const Name& certName) const = 0;
250 
259  virtual std::set<Name>
260  getCertificatesOfKey(const Name& keyName) const = 0;
261 
267  virtual void
268  setDefaultCertificateOfKey(const Name& keyName, const Name& certName) = 0;
269 
275  virtual v2::Certificate
276  getDefaultCertificateOfKey(const Name& keyName) const = 0;
277 };
278 
279 } // namespace pib
280 } // namespace security
281 } // namespace ndn
282 
283 #endif // NDN_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.
The certificate following the certificate format naming convention.
Definition: certificate.hpp:81
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 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 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:43
virtual Name getDefaultIdentity() const =0
Get the default identity.
virtual void addKey(const Name &identity, const Name &keyName, const uint8_t *key, size_t keyLen)=0
Add a key.
virtual v2::Certificate getCertificate(const Name &certName) const =0
Get a certificate with name certName.
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 v2::Certificate getDefaultCertificateOfKey(const Name &keyName) const =0
virtual Name getDefaultKeyOfIdentity(const Name &identity) const =0
virtual void addCertificate(const v2::Certificate &certificate)=0
Add a certificate.
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:40
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.