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_PIB_SQLITE3_HPP
23 #define NDN_SECURITTY_PIB_PIB_SQLITE3_HPP
24 
25 #include "pib-impl.hpp"
26 
27 struct sqlite3;
28 
29 namespace ndn {
30 namespace security {
31 namespace pib {
32 
39 class PibSqlite3 : public PibImpl
40 {
41 public:
54  explicit
55  PibSqlite3(const std::string& location = "");
56 
60  ~PibSqlite3();
61 
62  static const std::string&
63  getScheme();
64 
65 public: // TpmLocator management
66  void
67  setTpmLocator(const std::string& tpmLocator) final;
68 
69  std::string
70  getTpmLocator() const final;
71 
72 public: // Identity management
73  bool
74  hasIdentity(const Name& identity) const final;
75 
76  void
77  addIdentity(const Name& identity) final;
78 
79  void
80  removeIdentity(const Name& identity) final;
81 
82  void
83  clearIdentities() final;
84 
85  std::set<Name>
86  getIdentities() const final;
87 
88  void
89  setDefaultIdentity(const Name& identityName) final;
90 
91  Name
92  getDefaultIdentity() const final;
93 
94 public: // Key management
95  bool
96  hasKey(const Name& keyName) const final;
97 
98  void
99  addKey(const Name& identity, const Name& keyName,
100  const uint8_t* key, size_t keyLen) final;
101 
102  void
103  removeKey(const Name& keyName) final;
104 
105  Buffer
106  getKeyBits(const Name& keyName) const final;
107 
108  std::set<Name>
109  getKeysOfIdentity(const Name& identity) const final;
110 
111  void
112  setDefaultKeyOfIdentity(const Name& identity, const Name& keyName) final;
113 
114  Name
115  getDefaultKeyOfIdentity(const Name& identity) const final;
116 
117 public: // Certificate Management
118  bool
119  hasCertificate(const Name& certName) const final;
120 
121  void
122  addCertificate(const v2::Certificate& certificate) final;
123 
124  void
125  removeCertificate(const Name& certName) final;
126 
128  getCertificate(const Name& certName) const final;
129 
130  std::set<Name>
131  getCertificatesOfKey(const Name& keyName) const final;
132 
133  void
134  setDefaultCertificateOfKey(const Name& keyName, const Name& certName) final;
135 
137  getDefaultCertificateOfKey(const Name& keyName) const final;
138 
139 private:
140  bool
141  hasDefaultIdentity() const;
142 
143  bool
144  hasDefaultKeyOfIdentity(const Name& identity) const;
145 
146  bool
147  hasDefaultCertificateOfKey(const Name& keyName) const;
148 
149 private:
150  sqlite3* m_database;
151 };
152 
153 } // namespace pib
154 } // namespace security
155 } // namespace ndn
156 
157 #endif // NDN_SECURITTY_PIB_PIB_SQLITE3_HPP
void removeCertificate(const Name &certName) final
Remove a certificate with name certName.
Copyright (c) 2011-2015 Regents of the University of California.
Name getDefaultKeyOfIdentity(const Name &identity) const final
The certificate following the certificate format naming convention.
Definition: certificate.hpp:81
std::set< Name > getCertificatesOfKey(const Name &keyName) const final
Get a list of certificate names of a key with id keyName.
void clearIdentities() final
Erasing all certificates, keys, and identities.
void addKey(const Name &identity, const Name &keyName, const uint8_t *key, size_t keyLen) final
Add a key.
std::set< Name > getIdentities() const final
Get the name of all the identities.
void setTpmLocator(const std::string &tpmLocator) final
Set the corresponding TPM information to tpmLocator.
Catch-all error for security policy errors that don&#39;t fit in other categories.
Definition: base.hpp:79
v2::Certificate getCertificate(const Name &certName) const final
Get a certificate with name certName.
Pib backend implementation based on SQLite3 database.
Definition: pib-sqlite3.hpp:39
std::string getTpmLocator() const final
Get TPM Locator.
Buffer getKeyBits(const Name &keyName) const final
Get the key bits of a key with name keyName.
static const std::string & getScheme()
void removeIdentity(const Name &identity) final
Remove an identity and related keys and certificates.
void setDefaultIdentity(const Name &identityName) final
Set an identity with name identityName as the default identity.
void setDefaultCertificateOfKey(const Name &keyName, const Name &certName) final
Set a cert with name certName as the default of a key with keyName.
Name getDefaultIdentity() const final
Get the default identity.
Represents an absolute name.
Definition: name.hpp:42
~PibSqlite3()
Destruct and cleanup internal state.
PibSqlite3(const std::string &location="")
Create sqlite3-based PIB backed.
void addIdentity(const Name &identity) final
Add an identity.
void addCertificate(const v2::Certificate &certificate) final
Add a certificate.
v2::Certificate getDefaultCertificateOfKey(const Name &keyName) const final
bool hasKey(const Name &keyName) const final
Check the existence of a key with keyName.
void removeKey(const Name &keyName) final
Remove a key with keyName and related certificates.
void setDefaultKeyOfIdentity(const Name &identity, const Name &keyName) final
Set an key with keyName as the default key of an identity with name identity.
std::set< Name > getKeysOfIdentity(const Name &identity) const final
Get all the key names of an identity with name identity.
bool hasIdentity(const Name &identity) const final
Check the existence of an identity.
General-purpose automatically managed/resized buffer.
Definition: buffer.hpp:40
Abstract class of PIB implementation.
Definition: pib-impl.hpp:39
bool hasCertificate(const Name &certName) const final
Check the existence of a certificate with name certName.