NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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; -*- */
22 #ifndef NDN_SECURITY_PIB_IMPL_HPP
23 #define NDN_SECURITY_PIB_IMPL_HPP
24 
25 #include <set>
26 #include "identity-certificate.hpp"
27 
28 namespace ndn {
29 namespace security {
30 
37 class PibImpl
38 {
39 public:
46  class Error : public std::runtime_error
47  {
48  public:
49  explicit
50  Error(const std::string& what)
51  : std::runtime_error(what)
52  {
53  }
54  };
55 
56 public:
57 
58  virtual
60  {
61  }
62 
63 public: // TpmLocator management
64 
73  virtual void
74  setTpmLocator(const std::string& tpmLocator) = 0;
75 
79  virtual std::string
80  getTpmLocator() const = 0;
81 
82 public: // Identity management
83 
90  virtual bool
91  hasIdentity(const Name& identity) const = 0;
92 
101  virtual void
102  addIdentity(const Name& identity) = 0;
103 
112  virtual void
113  removeIdentity(const Name& identity) = 0;
114 
116  virtual std::set<Name>
117  getIdentities() const = 0;
118 
127  virtual void
128  setDefaultIdentity(const Name& identityName) = 0;
129 
136  virtual Name
137  getDefaultIdentity() const = 0;
138 
139 public: // Key management
140 
148  virtual bool
149  hasKey(const Name& identity, const name::Component& keyId) const = 0;
150 
163  virtual void
164  addKey(const Name& identity, const name::Component& keyId, const PublicKey& publicKey) = 0;
165 
175  virtual void
176  removeKey(const Name& identity, const name::Component& keyId) = 0;
177 
186  virtual PublicKey
187  getKeyBits(const Name& identity, const name::Component& keyId) const = 0;
188 
197  virtual std::set<name::Component>
198  getKeysOfIdentity(const Name& identity) const = 0;
199 
207  virtual void
208  setDefaultKeyOfIdentity(const Name& identity, const name::Component& keyId) = 0;
209 
216  virtual name::Component
217  getDefaultKeyOfIdentity(const Name& identity) const = 0;
218 
219 public: // Certificate Management
220 
227  virtual bool
228  hasCertificate(const Name& certName) const = 0;
229 
240  virtual void
241  addCertificate(const IdentityCertificate& certificate) = 0;
242 
250  virtual void
251  removeCertificate(const Name& certName) = 0;
252 
260  virtual IdentityCertificate
261  getCertificate(const Name& certName) const = 0;
262 
273  virtual std::set<Name>
274  getCertificatesOfKey(const Name& identity, const name::Component& keyId) const = 0;
275 
284  virtual void
285  setDefaultCertificateOfKey(const Name& identity, const name::Component& keyId,
286  const Name& certName) = 0;
287 
296  virtual IdentityCertificate
297  getDefaultCertificateOfKey(const Name& identity, const name::Component& keyId) const = 0;
298 
299 };
300 
301 } // namespace security
302 } // namespace ndn
303 
304 #endif // NDN_SECURITY_PIB_IMPL_HPP
virtual void removeKey(const Name &identity, const name::Component &keyId)=0
Remove a key.
virtual IdentityCertificate getDefaultCertificateOfKey(const Name &identity, const name::Component &keyId) const =0
Get the default certificate of a key with id of .
represents a non-semantic error
Definition: pib-impl.hpp:46
Copyright (c) 2011-2015 Regents of the University of California.
virtual void removeCertificate(const Name &certName)=0
Remove a certificate with name certName.
virtual Name getDefaultIdentity() const =0
Get the default identity.
virtual void addKey(const Name &identity, const name::Component &keyId, const PublicKey &publicKey)=0
Add a key.
virtual std::set< Name > getCertificatesOfKey(const Name &identity, const name::Component &keyId) const =0
Get a list of certificate names of a key with id keyId of identity.
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.
STL namespace.
virtual void addIdentity(const Name &identity)=0
Add an identity.
virtual bool hasIdentity(const Name &identity) const =0
Check the existence of an identity.
virtual PublicKey getKeyBits(const Name &identity, const name::Component &keyId) const =0
Get the key bits of a key.
virtual std::set< Name > getIdentities() const =0
Get the name of all the identities.
Error(const std::string &what)
Definition: pib-impl.hpp:50
virtual name::Component getDefaultKeyOfIdentity(const Name &identity) const =0
Get the id of the default key of an identity with name identity.
Name abstraction to represent an absolute name.
Definition: name.hpp:46
Abstract class of PIB implementation.
Definition: pib-impl.hpp:37
virtual std::set< name::Component > getKeysOfIdentity(const Name &identity) const =0
Get all the key ids of an identity with name identity.
virtual void addCertificate(const IdentityCertificate &certificate)=0
Add a certificate.
virtual void setDefaultKeyOfIdentity(const Name &identity, const name::Component &keyId)=0
Set an key with id keyId as the default key of an identity with name identity.
Component holds a read-only name component value.
virtual void setDefaultCertificateOfKey(const Name &identity, const name::Component &keyId, const Name &certName)=0
Set a cert with name certName as the default of a key with id of .
virtual void setTpmLocator(const std::string &tpmLocator)=0
Set the corresponding TPM information to tpmLocator.
virtual void removeIdentity(const Name &identity)=0
Remove an identity.
virtual void setDefaultIdentity(const Name &identityName)=0
Set an identity with name identityName as the default identity.
virtual bool hasKey(const Name &identity, const name::Component &keyId) const =0
Check the existence of a key.
virtual IdentityCertificate getCertificate(const Name &certName) const =0
Get a certificate with name certName.