identity-impl.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SECURITY_PIB_DETAIL_IDENTITY_IMPL_HPP
23 #define NDN_SECURITY_PIB_DETAIL_IDENTITY_IMPL_HPP
24 
25 #include "../key-container.hpp"
26 
27 namespace ndn {
28 namespace security {
29 namespace pib {
30 
31 class PibImpl;
32 
33 namespace detail {
34 
43 class IdentityImpl : noncopyable
44 {
45 public:
54  IdentityImpl(const Name& identityName, shared_ptr<PibImpl> impl, bool needInit = false);
55 
57  const Name&
58  getName() const
59  {
60  return m_name;
61  }
62 
72  Key
73  addKey(const uint8_t* key, size_t keyLen, const Name& keyName);
74 
79  void
80  removeKey(const Name& keyName);
81 
88  Key
89  getKey(const Name& keyName) const;
90 
94  const KeyContainer&
95  getKeys() const;
96 
103  const Key&
104  setDefaultKey(const Name& keyName);
105 
112  const Key&
113  setDefaultKey(const uint8_t* key, size_t keyLen, const Name& keyName);
114 
119  const Key&
120  getDefaultKey() const;
121 
122 private:
123  Name m_name;
124 
125  mutable bool m_isDefaultKeyLoaded;
126  mutable Key m_defaultKey;
127 
128  mutable KeyContainer m_keys;
129 
130  shared_ptr<PibImpl> m_impl;
131 };
132 
133 } // namespace detail
134 } // namespace pib
135 } // namespace security
136 } // namespace ndn
137 
138 #endif // NDN_SECURITY_PIB_DETAIL_IDENTITY_IMPL_HPP
Backend instance of Identity.
Copyright (c) 2013-2016 Regents of the University of California.
Definition: common.hpp:74
const KeyContainer & getKeys() const
Get all keys for this Identity.
const Key & setDefaultKey(const Name &keyName)
Set the key with id keyName.
Key getKey(const Name &keyName) const
Get a key with id keyName.
Container of keys of an identity.
A frontend handle of a key instance.
Definition: key.hpp:49
Name abstraction to represent an absolute name.
Definition: name.hpp:46
void removeKey(const Name &keyName)
Remove a key with keyName.
Key addKey(const uint8_t *key, size_t keyLen, const Name &keyName)
Add a key of keyLen bytes with keyName (in PKCS#8 format).
const Key & getDefaultKey() const
Get the default key for this Identity.
const Name & getName() const
Get the name of the identity.
IdentityImpl(const Name &identityName, shared_ptr< PibImpl > impl, bool needInit=false)
Create an Identity with identityName.