NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
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> pibImpl, bool needInit = false);
55 
59  const Name&
60  getName() const
61  {
62  return m_name;
63  }
64 
74  Key
75  addKey(const uint8_t* key, size_t keyLen, const Name& keyName);
76 
81  void
82  removeKey(const Name& keyName);
83 
90  Key
91  getKey(const Name& keyName) const;
92 
96  const KeyContainer&
97  getKeys() const;
98 
105  const Key&
106  setDefaultKey(const Name& keyName);
107 
114  const Key&
115  setDefaultKey(const uint8_t* key, size_t keyLen, const Name& keyName);
116 
121  const Key&
122  getDefaultKey() const;
123 
124 private:
125  Name m_name;
126 
127  shared_ptr<PibImpl> m_pib;
128 
129  KeyContainer m_keys;
130  mutable bool m_isDefaultKeyLoaded;
131  mutable Key m_defaultKey;
132 };
133 
134 } // namespace detail
135 } // namespace pib
136 } // namespace security
137 } // namespace ndn
138 
139 #endif // NDN_SECURITY_PIB_DETAIL_IDENTITY_IMPL_HPP
Backend instance of Identity.
Copyright (c) 2011-2015 Regents of the University of California.
const Key & setDefaultKey(const Name &keyName)
Set the key with id keyName.
const KeyContainer & getKeys() const
Get all keys for this Identity.
Container of keys of an identity.
A frontend handle of a key instance.
Definition: key.hpp:49
IdentityImpl(const Name &identityName, shared_ptr< PibImpl > pibImpl, bool needInit=false)
Create an Identity with identityName.
Represents an absolute name.
Definition: name.hpp:42
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 Name & getName() const
Get the name of the identity.
Key getKey(const Name &keyName) const
Get a key with id keyName.
const Key & getDefaultKey() const
Get the default key for this Identity.