ndn-cxx: NDN C++ Library 0.9.0-33-g832ea91d
Loading...
Searching...
No Matches
pib.hpp
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013-2023 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_CXX_SECURITY_PIB_PIB_HPP
23#define NDN_CXX_SECURITY_PIB_PIB_HPP
24
26
27namespace ndn::security {
28namespace pib {
29
30class PibImpl;
31
51class Pib : noncopyable
52{
53public:
55 class Error : public std::runtime_error
56 {
57 public:
58 using std::runtime_error::runtime_error;
59 };
60
62
66 const std::string&
68 {
69 return m_locator;
70 }
71
75 std::string
76 getTpmLocator() const;
77
82 void
83 setTpmLocator(const std::string& tpmLocator);
84
88 void
89 reset();
90
96 getIdentity(const Name& identityName) const;
97
101 const IdentityContainer&
102 getIdentities() const;
103
109 getDefaultIdentity() const;
110
111NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // write operations are accessible only by KeyChain
118 Pib(const std::string& locator, shared_ptr<PibImpl> impl);
119
128 addIdentity(const Name& identity);
129
135 void
136 removeIdentity(const Name& identity);
137
146 setDefaultIdentity(const Name& identity);
147
148private:
149 const std::string m_locator;
150 const shared_ptr<PibImpl> m_impl;
151
152 IdentityContainer m_identities;
153 mutable Identity m_defaultIdentity;
154
155 friend KeyChain;
156};
157
158} // namespace pib
159
160using pib::Pib;
161
162} // namespace ndn::security
163
164#endif // NDN_CXX_SECURITY_PIB_PIB_HPP
Represents an absolute name.
Definition name.hpp:45
The main interface for signing key management.
Definition key-chain.hpp:87
Container of identities of a PIB.
Frontend handle for an identity in the PIB.
Definition identity.hpp:44
Represents a semantic error.
Definition pib.hpp:56
Frontend to the Public Information Base.
Definition pib.hpp:52
Identity getIdentity(const Name &identityName) const
Return an identity with name identityName.
Definition pib.cpp:87
const std::string & getPibLocator() const
Return the PIB Locator.
Definition pib.hpp:67
void reset()
Reset the contents of the PIB, including reset of the TPM Locator.
Definition pib.cpp:59
Identity getDefaultIdentity() const
Return the default identity.
Definition pib.cpp:114
void setTpmLocator(const std::string &tpmLocator)
Set the associated TPM information to tpmLocator.
Definition pib.cpp:47
std::string getTpmLocator() const
Return the associated TPM Locator or an empty string if unset.
Definition pib.cpp:41
const IdentityContainer & getIdentities() const
Return all the identities.
Definition pib.cpp:94
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition common.hpp:49
Contains the ndn-cxx security framework.