All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
pib-identity.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
30 #ifndef NDN_PIB_IDENTITY_HPP
31 #define NDN_PIB_IDENTITY_HPP
32 
33 #include "pib-key-container.hpp"
34 
35 // Give friend access to the tests.
36 class TestKeyChain_Management_Test;
37 
38 namespace ndn {
39 
40 class PibIdentityImpl;
41 
48 class PibIdentity {
49 public:
50  /*
51  * Get the name of the identity.
52  * @return The name of the identity.
53  * @throws std::domain_error if the backend implementation instance is invalid.
54  */
55  const Name&
56  getName();
57 
66  ptr_lib::shared_ptr<PibKey>
67  getKey(const Name& keyName);
68 
75  ptr_lib::shared_ptr<PibKey>&
76  getDefaultKey();
77 
78 private:
79  friend class PibIdentityContainer;
80  friend class KeyChain;
81  // Give friend access to the tests.
82  friend TestKeyChain_Management_Test;
83 
88  PibIdentity(ptr_lib::weak_ptr<PibIdentityImpl> impl);
89 
99  ptr_lib::shared_ptr<PibKey>
100  addKey(const uint8_t* key, size_t keyLength, const Name& keyName);
101 
107  void
108  removeKey(const Name& keyName);
109 
118  ptr_lib::shared_ptr<PibKey>&
119  setDefaultKey(const Name& keyName);
120 
131  ptr_lib::shared_ptr<PibKey>&
132  setDefaultKey(const uint8_t* key, size_t keyLength, const Name& keyName);
133 
139  getKeys();
140 
146  ptr_lib::shared_ptr<PibIdentityImpl>
147  lock();
148 
149  // Disable the copy constructor and assignment operator.
150  PibIdentity(const PibIdentity& other);
151  PibIdentity& operator=(const PibIdentity& other);
152 
153  ptr_lib::weak_ptr<PibIdentityImpl> impl_;
154 };
155 
156 }
157 
158 #endif
A PibIdentityContainer is used to search/enumerate the identities in a PIB.
Definition: pib-identity-container.hpp:44
ptr_lib::shared_ptr< PibKey > getKey(const Name &keyName)
Get the key with name keyName.
Definition: pib-identity.cpp:34
KeyChain is the main class of the security library.
Definition: key-chain.hpp:53
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
A PibKeyContainer is used to search/enumerate the keys of an identity.
Definition: pib-key-container.hpp:42
ptr_lib::shared_ptr< PibKey > & getDefaultKey()
Get the default key of this Identity.
Definition: pib-identity.cpp:37