All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
pib-identity-impl.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_PIB_IDENTITY_IMPL_HPP
24 #define NDN_PIB_IDENTITY_IMPL_HPP
25 
26 #include <ndn-cpp/security/pib/pib-key-container.hpp>
27 
28 // Give friend access to the tests.
29 class TestPibIdentityImpl_KeyOperation_Test;
30 
31 namespace ndn {
32 
33 class PibKey;
34 
42 public:
55  (const Name& identityName, const ptr_lib::shared_ptr<PibImpl>& pibImpl,
56  bool needInit);
57 
58  /*
59  * Get the name of the identity.
60  * @return The name of the identity.
61  */
62  const Name&
63  getName() { return identityName_; }
64 
74  ptr_lib::shared_ptr<PibKey>
75  addKey(const uint8_t* key, size_t keyLength, const Name& keyName);
76 
82  void
83  removeKey(const Name& keyName);
84 
92  ptr_lib::shared_ptr<PibKey>
93  getKey(const Name& keyName);
94 
103  ptr_lib::shared_ptr<PibKey>&
104  setDefaultKey(const Name& keyName);
105 
116  ptr_lib::shared_ptr<PibKey>&
117  setDefaultKey(const uint8_t* key, size_t keyLength, const Name& keyName);
118 
124  ptr_lib::shared_ptr<PibKey>&
125  getDefaultKey();
126 
127 private:
128  friend class PibIdentity;
129  // Give friend access to the tests.
130  friend TestPibIdentityImpl_KeyOperation_Test;
131 
132  // Disable the copy constructor and assignment operator.
133  PibIdentityImpl(const PibIdentityImpl& other);
134  PibIdentityImpl& operator=(const PibIdentityImpl& other);
135 
136  Name identityName_;
137  ptr_lib::shared_ptr<PibKey> defaultKey_;
138 
139  PibKeyContainer keys_;
140 
141  ptr_lib::shared_ptr<PibImpl> pibImpl_;
142 };
143 
144 }
145 
146 #endif
ptr_lib::shared_ptr< PibKey > getKey(const Name &keyName)
Get the key with name keyName.
Definition: pib-identity-impl.cpp:69
PibIdentityImpl(const Name &identityName, const ptr_lib::shared_ptr< PibImpl > &pibImpl, bool needInit)
Create a PibIdentityImpl with identityName.
Definition: pib-identity-impl.cpp:31
void removeKey(const Name &keyName)
Remove the key with keyName and its related certificates.
Definition: pib-identity-impl.cpp:58
PibIdentity is at the top level in PIB's Identity-Key-Certificate hierarchy.
Definition: pib-identity.hpp:48
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
PibIdentityImpl provides the backend implementation for PibIdentity.
Definition: pib-identity-impl.hpp:41
ptr_lib::shared_ptr< PibKey > addKey(const uint8_t *key, size_t keyLength, const Name &keyName)
Add the key.
Definition: pib-identity-impl.cpp:50
ptr_lib::shared_ptr< PibKey > & getDefaultKey()
Get the default key of this Identity.
Definition: pib-identity-impl.cpp:95
A PibKeyContainer is used to search/enumerate the keys of an identity.
Definition: pib-key-container.hpp:42
ptr_lib::shared_ptr< PibKey > & setDefaultKey(const Name &keyName)
Set the key with name keyName as the default key of the identity.
Definition: pib-identity-impl.cpp:77