identity.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SECURITY_PIB_IDENTITY_HPP
23 #define NDN_SECURITY_PIB_IDENTITY_HPP
24 
25 #include "key-container.hpp"
26 
27 namespace ndn {
28 namespace security {
29 namespace pib {
30 
31 namespace detail {
32 class IdentityImpl;
33 } // namespace detail
34 
42 class Identity
43 {
44 public:
63  Identity();
64 
70  explicit
71  Identity(weak_ptr<detail::IdentityImpl> impl);
72 
76  const Name&
77  getName() const;
78 
84  Key
85  getKey(const Name& keyName) const;
86 
90  const KeyContainer&
91  getKeys() const;
92 
97  const Key&
98  getDefaultKey() const;
99 
100  /*
101  * @return True if the identity instance is valid
102  */
103  operator bool() const;
104 
108  bool
109  operator!() const;
110 
111 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // write operations should be private
118  Key
119  addKey(const uint8_t* key, size_t keyLen, const Name& keyName) const;
120 
125  void
126  removeKey(const Name& keyName) const;
127 
134  const Key&
135  setDefaultKey(const Name& keyName) const;
136 
143  const Key&
144  setDefaultKey(const uint8_t* key, size_t keyLen, const Name& keyName) const;
145 
146 private:
152  shared_ptr<detail::IdentityImpl>
153  lock() const;
154 
155 private:
156  weak_ptr<detail::IdentityImpl> m_impl;
157 
158  friend class v2::KeyChain;
159 };
160 
161 } // namespace pib
162 
163 using pib::Identity;
164 
165 } // namespace security
166 } // namespace ndn
167 
168 #endif // NDN_SECURITY_PIB_IDENTITY_HPP
Copyright (c) 2013-2016 Regents of the University of California.
Definition: common.hpp:74
const Key & getDefaultKey() const
Get the default key for this Identity.
Definition: identity.cpp:79
The interface of signing key management.
Identity()
Default Constructor.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:43
Container of keys of an identity.
const KeyContainer & getKeys() const
Get all keys for this identity.
Definition: identity.cpp:61
A frontend handle of a key instance.
Definition: key.hpp:49
Name abstraction to represent an absolute name.
Definition: name.hpp:46
Key getKey(const Name &keyName) const
Get a key with id keyName.
Definition: identity.cpp:55
const Name & getName() const
Get the name of the identity.
Definition: identity.cpp:37
A frontend handle of an Identity.
Definition: identity.hpp:42