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
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
ndn::security::pib::PibImpl::setDefaultIdentity
virtual void setDefaultIdentity(const Name &identityName)=0
Set an identity with name identityName as the default identity.
ndn::security::pib::PibImpl::getKeysOfIdentity
virtual std::set< Name > getKeysOfIdentity(const Name &identity) const =0
Get all the key names of an identity with name identity.
ndn::security::pib::PibImpl::addKey
virtual void addKey(const Name &identity, const Name &keyName, const uint8_t *key, size_t keyLen)=0
Add a key.
ndn::security::pib::PibImpl::getDefaultCertificateOfKey
virtual v2::Certificate getDefaultCertificateOfKey(const Name &keyName) const =0
certificate.hpp
ndn::security::pib::PibImpl::removeIdentity
virtual void removeIdentity(const Name &identity)=0
Remove an identity and related keys and certificates.
ndn::security::pib::PibImpl::getCertificatesOfKey
virtual std::set< Name > getCertificatesOfKey(const Name &keyName) const =0
Get a list of certificate names of a key with id keyName.
ndn::security::pib::PibImpl::addIdentity
virtual void addIdentity(const Name &identity)=0
Add an identity.
ndn::security::pib::PibImpl::Error
represents a non-semantic error
Definition: pib-impl.hpp:50
ndn::Buffer
General-purpose automatically managed/resized buffer.
Definition: buffer.hpp:41
ndn::security::pib::PibImpl::setDefaultKeyOfIdentity
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.
ndn::security::pib::PibImpl::getDefaultKeyOfIdentity
virtual Name getDefaultKeyOfIdentity(const Name &identity) const =0
ndn::security::pib::PibImpl::setTpmLocator
virtual void setTpmLocator(const std::string &tpmLocator)=0
Set the corresponding TPM information to tpmLocator.
ndn::security::pib::PibImpl::getIdentities
virtual std::set< Name > getIdentities() const =0
Get the name of all the identities.
ndn::security::pib::PibImpl::addCertificate
virtual void addCertificate(const v2::Certificate &certificate)=0
Add a certificate.
ndn::security::pib::PibImpl::clearIdentities
virtual void clearIdentities()=0
Erasing all certificates, keys, and identities.
ndn::security::pib::PibImpl::~PibImpl
virtual ~PibImpl()=default
ndn::Name
Represents an absolute name.
Definition: name.hpp:44
ndn::security::pib::PibImpl::removeKey
virtual void removeKey(const Name &keyName)=0
Remove a key with keyName and related certificates.
ndn::security::v2::Certificate
The certificate following the certificate format naming convention.
Definition: certificate.hpp:82
ndn::security::pib::PibImpl::getDefaultIdentity
virtual Name getDefaultIdentity() const =0
Get the default identity.
ndn::security::pib::PibImpl::removeCertificate
virtual void removeCertificate(const Name &certName)=0
Remove a certificate with name certName.
ndn::security::pib::PibImpl::setDefaultCertificateOfKey
virtual void setDefaultCertificateOfKey(const Name &keyName, const Name &certName)=0
Set a cert with name certName as the default of a key with keyName.
ndn::security::pib::PibImpl::getKeyBits
virtual Buffer getKeyBits(const Name &keyName) const =0
Get the key bits of a key with name keyName.
ndn::security::pib::PibImpl::getTpmLocator
virtual std::string getTpmLocator() const =0
Get TPM Locator.
pib.hpp
ndn::security::pib::PibImpl::hasKey
virtual bool hasKey(const Name &keyName) const =0
Check the existence of a key with keyName.
ndn::security::pib::PibImpl::hasCertificate
virtual bool hasCertificate(const Name &certName) const =0
Check the existence of a certificate with name certName.
ndn::security::pib::PibImpl::hasIdentity
virtual bool hasIdentity(const Name &identity) const =0
Check the existence of an identity.
ndn::security::pib::PibImpl
Abstract class of PIB implementation.
Definition: pib-impl.hpp:41
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
ndn::security::pib::PibImpl::getCertificate
virtual v2::Certificate getCertificate(const Name &certName) const =0
Get a certificate with name certName.