NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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 
63  virtual void
64  setTpmLocator(const std::string& tpmLocator) final;
65 
66  virtual std::string
67  getTpmLocator() const final;
68 
69 public: // Identity management
70 
71  virtual bool
72  hasIdentity(const Name& identity) const final;
73 
74  virtual void
75  addIdentity(const Name& identity) final;
76 
77  virtual void
78  removeIdentity(const Name& identity) final;
79 
80  virtual std::set<Name>
81  getIdentities() const final;
82 
83  virtual void
84  setDefaultIdentity(const Name& identityName) final;
85 
86  virtual Name
87  getDefaultIdentity() const final;
88 
89 public: // Key management
90 
91  virtual bool
92  hasKey(const Name& identity, const name::Component& keyId) const final;
93 
94  virtual void
95  addKey(const Name& identity, const name::Component& keyId, const v1::PublicKey& publicKey) final;
96 
97  virtual void
98  removeKey(const Name& identity, const name::Component& keyId) final;
99 
100  virtual v1::PublicKey
101  getKeyBits(const Name& identity, const name::Component& keyId) const final;
102 
103  virtual std::set<name::Component>
104  getKeysOfIdentity(const Name& identity) const final;
105 
106  virtual void
107  setDefaultKeyOfIdentity(const Name& identity, const name::Component& keyId) final;
108 
109  virtual name::Component
110  getDefaultKeyOfIdentity(const Name& identity) const final;
111 
112 public: // Certificate Management
113 
114  virtual bool
115  hasCertificate(const Name& certName) const final;
116 
117  virtual void
118  addCertificate(const v1::IdentityCertificate& certificate) final;
119 
120  virtual void
121  removeCertificate(const Name& certName) final;
122 
124  getCertificate(const Name& certName) const final;
125 
126  virtual std::set<Name>
127  getCertificatesOfKey(const Name& identity, const name::Component& keyId) const final;
128 
129  virtual void
130  setDefaultCertificateOfKey(const Name& identity, const name::Component& keyId,
131  const Name& certName) final;
132 
134  getDefaultCertificateOfKey(const Name& identity, const name::Component& keyId) const final;
135 
136 private:
137  sqlite3* m_database;
138 };
139 
140 } // namespace security
141 } // namespace ndn
142 
143 #endif // NDN_SECURITTY_PIB_SQLITE3_HPP
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 keyId of identity.
Copyright (c) 2011-2015 Regents of the University of California.
virtual bool hasKey(const Name &identity, const name::Component &keyId) const final
Check the existence of a key.
virtual std::set< name::Component > getKeysOfIdentity(const Name &identity) const final
Get all the key ids of an identity with name identity.
virtual v1::IdentityCertificate getDefaultCertificateOfKey(const Name &identity, const name::Component &keyId) const final
Get the default certificate of a key with id keyId of identity.
virtual void addIdentity(const Name &identity) final
Add an identity.
Pib backend implementation based on SQLite3 database.
Definition: pib-sqlite3.hpp:38
virtual void removeIdentity(const Name &identity) final
Remove an identity.
virtual std::set< Name > getIdentities() const final
Get the name of all the identities.
virtual bool hasCertificate(const Name &certName) const final
Check the existence of a certificate with name certName.
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 addKey(const Name &identity, const name::Component &keyId, const v1::PublicKey &publicKey) final
Add a key.
virtual void addCertificate(const v1::IdentityCertificate &certificate) final
Add a certificate.
Name abstraction to represent an absolute name.
Definition: name.hpp:46
virtual std::string getTpmLocator() const final
Get TPM Locator.
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 void removeCertificate(const Name &certName) final
Remove a certificate with name certName.
virtual v1::IdentityCertificate getCertificate(const Name &certName) const final
Get a certificate with name certName.
virtual Name getDefaultIdentity() const final
Get the default identity.
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 v1::PublicKey getKeyBits(const Name &identity, const name::Component &keyId) const final
Get the key bits of a key.
virtual void removeKey(const Name &identity, const name::Component &keyId) final
Remove a key.
~PibSqlite3()
Destruct and cleanup internal state.
virtual bool hasIdentity(const Name &identity) const final
Check the existence of an identity.
virtual name::Component getDefaultKeyOfIdentity(const Name &identity) const final
Get the id of the default key of an identity with name identity.