All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sec-public-info-sqlite3.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
9 #ifndef NDN_SECURITY_SEC_PUBLIC_INFO_SQLITE3_HPP
10 #define NDN_SECURITY_SEC_PUBLIC_INFO_SQLITE3_HPP
11 
12 #include "../common.hpp"
13 #include "sec-public-info.hpp"
14 
15 struct sqlite3;
16 
17 namespace ndn {
18 
20 {
21 public:
22  class Error : public SecPublicInfo::Error
23  {
24  public:
25  explicit
26  Error(const std::string& what)
27  : SecPublicInfo::Error(what)
28  {
29  }
30  };
31 
33 
34  virtual
36 
37  /**********************
38  * from SecPublicInfo *
39  **********************/
40  virtual bool
41  doesIdentityExist(const Name& identityName);
42 
43  virtual void
44  addIdentity(const Name& identityName);
45 
46  virtual bool
48 
49  virtual bool
50  doesPublicKeyExist(const Name& keyName);
51 
52  virtual void
53  addPublicKey(const Name& keyName, KeyType keyType, const PublicKey& publicKeyDer);
54 
55  virtual shared_ptr<PublicKey>
56  getPublicKey(const Name& keyName);
57 
58  virtual bool
59  doesCertificateExist(const Name& certificateName);
60 
61  virtual void
62  addCertificate(const IdentityCertificate& certificate);
63 
64  virtual shared_ptr<IdentityCertificate>
65  getCertificate(const Name& certificateName);
66 
67 
68 
69  virtual Name
71 
72  virtual Name
73  getDefaultKeyNameForIdentity(const Name& identityName);
74 
75  virtual Name
76  getDefaultCertificateNameForKey(const Name& keyName);
77 
78  virtual void
79  getAllIdentities(std::vector<Name>& nameList, bool isDefault);
80 
81  virtual void
82  getAllKeyNames(std::vector<Name>& nameList, bool isDefault);
83 
84  virtual void
85  getAllKeyNamesOfIdentity(const Name& identity, std::vector<Name>& nameList, bool isDefault);
86 
87  virtual void
88  getAllCertificateNames(std::vector<Name>& nameList, bool isDefault);
89 
90  virtual void
91  getAllCertificateNamesOfKey(const Name& keyName, std::vector<Name>& nameList, bool isDefault);
92 
93 protected:
94  virtual void
95  setDefaultIdentityInternal(const Name& identityName);
96 
97  virtual void
99 
100  virtual void
101  setDefaultCertificateNameForKeyInternal(const Name& certificateName);
102 
103  virtual void
104  deleteCertificateInfo(const Name& certificateName);
105 
106  virtual void
107  deletePublicKeyInfo(const Name& keyName);
108 
109  virtual void
110  deleteIdentityInfo(const Name& identity);
111 
112 private:
113  sqlite3 * m_database;
114 };
115 
116 } // namespace ndn
117 
118 #endif //NDN_SECURITY_SEC_PUBLIC_INFO_SQLITE3_HPP
virtual void setDefaultKeyNameForIdentityInternal(const Name &keyName)
Set the default key name for the corresponding identity.
virtual bool doesIdentityExist(const Name &identityName)
Check if the specified identity already exists.
virtual void getAllKeyNames(std::vector< Name > &nameList, bool isDefault)
Get all the key name in public info.
virtual shared_ptr< IdentityCertificate > getCertificate(const Name &certificateName)
Get a certificate from the identity storage.
virtual void addPublicKey(const Name &keyName, KeyType keyType, const PublicKey &publicKeyDer)
Add a public key to the identity storage.
virtual void getAllCertificateNamesOfKey(const Name &keyName, std::vector< Name > &nameList, bool isDefault)
Get all the certificate name of a particular key.
virtual bool doesCertificateExist(const Name &certificateName)
Check if the specified certificate already exists.
virtual void setDefaultCertificateNameForKeyInternal(const Name &certificateName)
Set the default certificate name for the corresponding key.
virtual Name getDefaultKeyNameForIdentity(const Name &identityName)
Get the default key name for the specified identity.
virtual bool doesPublicKeyExist(const Name &keyName)
Check if the specified key already exists.
virtual shared_ptr< PublicKey > getPublicKey(const Name &keyName)
Get the public key DER blob from the identity storage.
virtual bool revokeIdentity()
Revoke the identity.
virtual void deletePublicKeyInfo(const Name &keyName)
Delete a public key and related certificates.
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:26
virtual void getAllIdentities(std::vector< Name > &nameList, bool isDefault)
Get all the identities in public info.
virtual Name getDefaultIdentity()
Get the default identity.
virtual void setDefaultIdentityInternal(const Name &identityName)
Set the default identity.
virtual void addIdentity(const Name &identityName)
Add a new identity.
virtual void deleteCertificateInfo(const Name &certificateName)
Delete a certificate.
virtual void getAllKeyNamesOfIdentity(const Name &identity, std::vector< Name > &nameList, bool isDefault)
Get all the key name of a particular identity.
virtual Name getDefaultCertificateNameForKey(const Name &keyName)
Get the default certificate name for the specified key.
virtual void addCertificate(const IdentityCertificate &certificate)
Add a certificate to the identity storage.
virtual void deleteIdentityInfo(const Name &identity)
Delete an identity and related public keys and certificates.
virtual void getAllCertificateNames(std::vector< Name > &nameList, bool isDefault)
Get all the certificate name in public info.
SecPublicInfo is a base class for the storage of public information.