NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
pib-sqlite3.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SECURITTY_PIB_SQLITE3_HPP
23 #define NDN_SECURITTY_PIB_SQLITE3_HPP
24 
25 #include "pib-impl.hpp"
26 
27 struct sqlite3;
28 
29 namespace ndn {
30 namespace security {
31 
38 class PibSqlite3 : public PibImpl
39 {
40 public:
53  explicit
54  PibSqlite3(const std::string& dir = "");
55 
59  ~PibSqlite3();
60 
61 public: // TpmLocator management
62 
71  virtual void
72  setTpmLocator(const std::string& tpmLocator) NDN_CXX_DECL_FINAL;
73 
77  virtual std::string
79 
80 public: // Identity management
81 
88  virtual bool
89  hasIdentity(const Name& identity) const NDN_CXX_DECL_FINAL;
90 
99  virtual void
100  addIdentity(const Name& identity) NDN_CXX_DECL_FINAL;
101 
110  virtual void
111  removeIdentity(const Name& identity) NDN_CXX_DECL_FINAL;
112 
116  virtual std::set<Name>
118 
127  virtual void
128  setDefaultIdentity(const Name& identityName) NDN_CXX_DECL_FINAL;
129 
136  virtual Name
138 
139 public: // Key management
140 
148  virtual bool
149  hasKey(const Name& identity, const name::Component& keyId) const NDN_CXX_DECL_FINAL;
150 
163  virtual void
164  addKey(const Name& identity, const name::Component& keyId, const PublicKey& publicKey) NDN_CXX_DECL_FINAL;
165 
175  virtual void
176  removeKey(const Name& identity, const name::Component& keyId) NDN_CXX_DECL_FINAL;
177 
186  virtual PublicKey
187  getKeyBits(const Name& identity, const name::Component& keyId) const NDN_CXX_DECL_FINAL;
188 
197  virtual std::set<name::Component>
198  getKeysOfIdentity(const Name& identity) const NDN_CXX_DECL_FINAL;
199 
207  virtual void
208  setDefaultKeyOfIdentity(const Name& identity, const name::Component& keyId) NDN_CXX_DECL_FINAL;
209 
216  virtual name::Component
217  getDefaultKeyOfIdentity(const Name& identity) const NDN_CXX_DECL_FINAL;
218 
219 public: // Certificate Management
220 
227  virtual bool
228  hasCertificate(const Name& certName) const NDN_CXX_DECL_FINAL;
229 
240  virtual void
242 
250  virtual void
251  removeCertificate(const Name& certName) NDN_CXX_DECL_FINAL;
252 
260  virtual IdentityCertificate
261  getCertificate(const Name& certName) const NDN_CXX_DECL_FINAL;
262 
273  virtual std::set<Name>
274  getCertificatesOfKey(const Name& identity, const name::Component& keyId) const NDN_CXX_DECL_FINAL;
275 
284  virtual void
285  setDefaultCertificateOfKey(const Name& identity, const name::Component& keyId,
286  const Name& certName) NDN_CXX_DECL_FINAL;
287 
296  virtual IdentityCertificate
297  getDefaultCertificateOfKey(const Name& identity, const name::Component& keyId) const NDN_CXX_DECL_FINAL;
298 
299 private:
300  sqlite3* m_database;
301 };
302 
303 } // namespace security
304 } // namespace ndn
305 
306 #endif // NDN_SECURITTY_PIB_SQLITE3_HPP
virtual bool hasCertificate(const Name &certName) const final
Check the existence of a certificate with name certName.
PibSqlite3(const std::string &dir="")
Constructor of PibSqlite3.
virtual void setDefaultIdentity(const Name &identityName) final
Set an identity with name identityName as the default identity.
virtual void setDefaultCertificateOfKey(const Name &identity, const name::Component &keyId, const Name &certName) final
Set a cert with name certName as the default of a key with id of .
Copyright (c) 2011-2015 Regents of the University of California.
virtual std::set< Name > getCertificatesOfKey(const Name &identity, const name::Component &keyId) const final
Get a list of certificate names of a key with id keyId of identity.
virtual void addIdentity(const Name &identity) final
Add an identity.
virtual PublicKey getKeyBits(const Name &identity, const name::Component &keyId) const final
Get the key bits of a key.
Pib backend implementation based on SQLite3 database.
Definition: pib-sqlite3.hpp:38
virtual name::Component getDefaultKeyOfIdentity(const Name &identity) const final
Get the id of the default key of an identity with name identity.
virtual void removeIdentity(const Name &identity) final
Remove an identity.
virtual bool hasKey(const Name &identity, const name::Component &keyId) const final
Check the existence of a key.
virtual IdentityCertificate getDefaultCertificateOfKey(const Name &identity, const name::Component &keyId) const final
Get the default certificate of a key with id of .
virtual std::string getTpmLocator() const final
Get TPM Locator.
virtual std::set< name::Component > getKeysOfIdentity(const Name &identity) const final
Get all the key ids of an identity with name identity.
Name abstraction to represent an absolute name.
Definition: name.hpp:46
virtual void setTpmLocator(const std::string &tpmLocator) final
Set the corresponding TPM information to tpmLocator.
Abstract class of PIB implementation.
Definition: pib-impl.hpp:37
virtual bool hasIdentity(const Name &identity) const final
Check the existence of an identity.
virtual void removeCertificate(const Name &certName) final
Remove a certificate with name certName.
virtual Name getDefaultIdentity() const final
Get the default identity.
virtual std::set< Name > getIdentities() const final
Get the name of all the identities.
virtual void addKey(const Name &identity, const name::Component &keyId, const PublicKey &publicKey) final
Add a key.
#define NDN_CXX_DECL_FINAL
expands to &#39;final&#39; if compiler supports this feature, otherwise expands to nothing ...
Definition: common.hpp:58
virtual void setDefaultKeyOfIdentity(const Name &identity, const name::Component &keyId) final
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 IdentityCertificate getCertificate(const Name &certName) const final
Get a certificate with name certName.
virtual void removeKey(const Name &identity, const name::Component &keyId) final
Remove a key.
~PibSqlite3()
Destruct and cleanup internal state.
virtual void addCertificate(const IdentityCertificate &certificate) final
Add a certificate.