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; -*- */
2 /*
3  * Copyright (c) 2013-2018 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  */
21 
22 #ifndef NDN_SECURITY_PIB_IMPL_IDENTITY_IMPL_HPP
23 #define NDN_SECURITY_PIB_IMPL_IDENTITY_IMPL_HPP
24 
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_IMPL_IDENTITY_IMPL_HPP
ndn::security::pib::detail::IdentityImpl::getName
const Name & getName() const
Get the name of the identity.
Definition: identity-impl.hpp:60
ndn::security::pib::detail::IdentityImpl::getKeys
const KeyContainer & getKeys() const
Get all keys for this Identity.
Definition: identity-impl.cpp:73
ndn::security::pib::detail::IdentityImpl::IdentityImpl
IdentityImpl(const Name &identityName, shared_ptr< PibImpl > pibImpl, bool needInit=false)
Create an Identity with identityName.
Definition: identity-impl.cpp:31
key-container.hpp
ndn::Name
Represents an absolute name.
Definition: name.hpp:44
ndn::security::pib::detail::IdentityImpl::getKey
Key getKey(const Name &keyName) const
Get a key with id keyName.
Definition: identity-impl.cpp:66
ndn::security::pib::detail::IdentityImpl
Backend instance of Identity.
Definition: identity-impl.hpp:44
ndn::security::pib::detail::IdentityImpl::removeKey
void removeKey(const Name &keyName)
Remove a key with keyName.
Definition: identity-impl.cpp:55
ndn::security::pib::detail::IdentityImpl::addKey
Key addKey(const uint8_t *key, size_t keyLen, const Name &keyName)
Add a key of keyLen bytes with keyName (in PKCS#8 format).
Definition: identity-impl.cpp:48
ndn::security::pib::Key
A frontend handle of a key instance.
Definition: key.hpp:50
ndn::security::pib::detail::IdentityImpl::setDefaultKey
const Key & setDefaultKey(const Name &keyName)
Set the key with id keyName.
Definition: identity-impl.cpp:80
ndn::security::pib::KeyContainer
Container of keys of an identity.
Definition: key-container.hpp:49
ndn::security::pib::detail::IdentityImpl::getDefaultKey
const Key & getDefaultKey() const
Get the default key for this Identity.
Definition: identity-impl.cpp:98
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34