ndn-cxx: NDN C++ Library 0.9.0-33-g832ea91d
Loading...
Searching...
No Matches
pib-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-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_IMPL_HPP
23#define NDN_CXX_SECURITY_PIB_PIB_IMPL_HPP
24
27
28#include <set>
29
30namespace ndn::security::pib {
31
40class PibImpl : noncopyable
41{
42public:
49 class Error : public std::runtime_error
50 {
51 public:
52 using std::runtime_error::runtime_error;
53 };
54
55 virtual
56 ~PibImpl() = default;
57
58public: // TPM Locator management
62 virtual std::string
63 getTpmLocator() const = 0;
64
70 virtual void
71 setTpmLocator(const std::string& tpmLocator) = 0;
72
73public: // Identity management
80 virtual bool
81 hasIdentity(const Name& identity) const = 0;
82
91 virtual void
92 addIdentity(const Name& identity) = 0;
93
102 virtual void
103 removeIdentity(const Name& identity) = 0;
104
108 virtual void
110
114 virtual std::set<Name>
115 getIdentities() const = 0;
116
124 virtual void
125 setDefaultIdentity(const Name& identityName) = 0;
126
133 virtual Name
135
136public: // Key management
142 virtual bool
143 hasKey(const Name& keyName) const = 0;
144
157 virtual void
158 addKey(const Name& identity, const Name& keyName, span<const uint8_t> key) = 0;
159
165 virtual void
166 removeKey(const Name& keyName) = 0;
167
174 virtual Buffer
175 getKeyBits(const Name& keyName) const = 0;
176
185 virtual std::set<Name>
186 getKeysOfIdentity(const Name& identity) const = 0;
187
193 virtual void
194 setDefaultKeyOfIdentity(const Name& identity, const Name& keyName) = 0;
195
201 virtual Name
202 getDefaultKeyOfIdentity(const Name& identity) const = 0;
203
204public: // Certificate Management
211 virtual bool
212 hasCertificate(const Name& certName) const = 0;
213
226 virtual void
227 addCertificate(const Certificate& certificate) = 0;
228
236 virtual void
237 removeCertificate(const Name& certName) = 0;
238
246 virtual Certificate
247 getCertificate(const Name& certName) const = 0;
248
257 virtual std::set<Name>
258 getCertificatesOfKey(const Name& keyName) const = 0;
259
265 virtual void
266 setDefaultCertificateOfKey(const Name& keyName, const Name& certName) = 0;
267
273 virtual Certificate
274 getDefaultCertificateOfKey(const Name& keyName) const = 0;
275};
276
277} // namespace ndn::security::pib
278
279#endif // NDN_CXX_SECURITY_PIB_PIB_IMPL_HPP
General-purpose automatically managed/resized buffer.
Definition buffer.hpp:43
Represents an absolute name.
Definition name.hpp:45
Represents an NDN certificate.
Represents a non-semantic error.
Definition pib-impl.hpp:50
PIB backend interface.
Definition pib-impl.hpp:41
virtual void addCertificate(const Certificate &certificate)=0
Add a certificate.
virtual void setDefaultIdentity(const Name &identityName)=0
Set an identity with name identityName as the default identity.
virtual void setTpmLocator(const std::string &tpmLocator)=0
Set the associated TPM information to tpmLocator.
virtual Certificate getCertificate(const Name &certName) const =0
Get a certificate with name certName.
virtual void setDefaultKeyOfIdentity(const Name &identity, const Name &keyName)=0
Set an key with keyName as the default key of an identity with name identity.
virtual bool hasKey(const Name &keyName) const =0
Check the existence of a key with keyName.
virtual Certificate getDefaultCertificateOfKey(const Name &keyName) const =0
virtual std::set< Name > getIdentities() const =0
Get the name of all the identities.
virtual std::set< Name > getKeysOfIdentity(const Name &identity) const =0
Get all the key names of an identity with name identity.
virtual Name getDefaultKeyOfIdentity(const Name &identity) const =0
virtual Name getDefaultIdentity() const =0
Get the default identity.
virtual bool hasCertificate(const Name &certName) const =0
Check the existence of a certificate with name certName.
virtual void removeCertificate(const Name &certName)=0
Remove a certificate with name certName.
virtual Buffer getKeyBits(const Name &keyName) const =0
Get the key bits of a key with name keyName.
virtual void clearIdentities()=0
Erasing all certificates, keys, and identities.
virtual void removeIdentity(const Name &identity)=0
Remove an identity and related keys and certificates.
virtual void setDefaultCertificateOfKey(const Name &keyName, const Name &certName)=0
Set a cert with name certName as the default of a key with keyName.
virtual ~PibImpl()=default
virtual std::string getTpmLocator() const =0
Return the associated TPM Locator or an empty string if unset.
virtual std::set< Name > getCertificatesOfKey(const Name &keyName) const =0
Get a list of certificate names of a key with id keyName.
virtual void addKey(const Name &identity, const Name &keyName, span< const uint8_t > key)=0
Add a key.
virtual void removeKey(const Name &keyName)=0
Remove a key with keyName and related certificates.
virtual void addIdentity(const Name &identity)=0
Add an identity.
virtual bool hasIdentity(const Name &identity) const =0
Check the existence of an identity.