ndn::security::pib::KeyContainer Class Reference

Container of keys of an identity. More...

#include <ndn-cxx/security/pib/key-container.hpp>

+ Inheritance diagram for ndn::security::pib::KeyContainer:
+ Collaboration diagram for ndn::security::pib::KeyContainer:

Classes

class  const_iterator
 

Public Types

using iterator = const_iterator
 

Public Member Functions

Key add (span< const uint8_t > key, const Name &keyName)
 Add key with name keyName into the container. More...
 
const_iterator begin () const noexcept
 
bool empty () const noexcept
 Check whether the container is empty. More...
 
const_iterator end () const noexcept
 
const_iterator find (const Name &keyName) const
 
Key get (const Name &keyName) const
 Return a key by name. More...
 
bool isConsistent () const
 Check if the container is consistent with the backend storage. More...
 
void remove (const Name &keyName)
 Remove a key with keyName from the container. More...
 
size_t size () const noexcept
 Return the number of keys in the container. More...
 

Friends

class IdentityImpl
 

Detailed Description

Container of keys of an identity.

The container is used to search/enumerate the keys of an identity. It can be created only by the IdentityImpl private class.

See also
Identity::getKeys()

Definition at line 42 of file key-container.hpp.

Member Typedef Documentation

◆ iterator

Member Function Documentation

◆ add()

Key ndn::security::pib::KeyContainer::add ( span< const uint8_t >  key,
const Name keyName 
)

Add key with name keyName into the container.

If a key with the same name already exists, it will be overwritten.

Exceptions
std::invalid_argumentkeyName does not match the identity.

Definition at line 56 of file key-container.cpp.

◆ begin()

const_iterator ndn::security::pib::KeyContainer::begin ( ) const
inlinenoexcept

Definition at line 94 of file key-container.hpp.

◆ empty()

bool ndn::security::pib::KeyContainer::empty ( ) const
inlinenoexcept

Check whether the container is empty.

Definition at line 112 of file key-container.hpp.

◆ end()

const_iterator ndn::security::pib::KeyContainer::end ( ) const
inlinenoexcept

Definition at line 100 of file key-container.hpp.

◆ find()

KeyContainer::const_iterator ndn::security::pib::KeyContainer::find ( const Name keyName) const

Definition at line 50 of file key-container.cpp.

◆ get()

Key ndn::security::pib::KeyContainer::get ( const Name keyName) const

Return a key by name.

Exceptions
Pib::ErrorThe key does not exist.
std::invalid_argumentkeyName does not match the identity.

Definition at line 92 of file key-container.cpp.

◆ isConsistent()

bool ndn::security::pib::KeyContainer::isConsistent ( ) const

Check if the container is consistent with the backend storage.

Note
This method is heavyweight and should be used in debugging mode only.

Definition at line 113 of file key-container.cpp.

◆ remove()

void ndn::security::pib::KeyContainer::remove ( const Name keyName)

Remove a key with keyName from the container.

Exceptions
std::invalid_argumentkeyName does not match the identity.

Definition at line 73 of file key-container.cpp.

◆ size()

size_t ndn::security::pib::KeyContainer::size ( ) const
inlinenoexcept

Return the number of keys in the container.

Definition at line 121 of file key-container.hpp.

Friends And Related Function Documentation

◆ IdentityImpl

friend class IdentityImpl
friend

Definition at line 174 of file key-container.hpp.