ndn::security::pib::Identity Class Reference

Frontend handle for an identity in the PIB. More...

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

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

Public Member Functions

 Identity () noexcept
 Default constructor. More...
 
Key getDefaultKey () const
 Return the default key for this identity. More...
 
Key getKey (const Name &keyName) const
 Obtain a handle to the key with the given name. More...
 
const KeyContainergetKeys () const
 Return all the keys of this identity. More...
 
const NamegetName () const
 Return the name of the identity. More...
 
 operator bool () const noexcept
 Returns true if the instance is valid. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Identity &id)
 
bool operator== (const Identity &lhs, const Identity &rhs) noexcept
 

Detailed Description

Frontend handle for an identity in the PIB.

Identity is at the top level in PIB's Identity-Key-Certificate hierarchy. An identity has a name, and contains zero or more keys, at most one of which is set as the default key of that identity. The properties of a key can be accessed after obtaining a Key object.

Definition at line 43 of file identity.hpp.

Constructor & Destructor Documentation

◆ Identity()

ndn::security::pib::Identity::Identity ( )
defaultnoexcept

Default constructor.

An Identity created using this default constructor is just a placeholder. You can obtain an actual instance from Pib::getIdentity(). A typical usage would be for exception handling:

try {
id = pib.getIdentity(...);
}
catch (const Pib::Error&) {
...
}
Identity() noexcept
Default constructor.

An instance created using this constructor is invalid. Calling a member function on an invalid Identity instance may throw an std::domain_error.

Member Function Documentation

◆ getDefaultKey()

Key ndn::security::pib::Identity::getDefaultKey ( ) const

Return the default key for this identity.

Exceptions
Pib::Errorthe default key does not exist.

Definition at line 77 of file identity.cpp.

◆ getKey()

Key ndn::security::pib::Identity::getKey ( const Name keyName) const

Obtain a handle to the key with the given name.

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

Definition at line 53 of file identity.cpp.

◆ getKeys()

const KeyContainer & ndn::security::pib::Identity::getKeys ( ) const

Return all the keys of this identity.

Definition at line 59 of file identity.cpp.

◆ getName()

const Name & ndn::security::pib::Identity::getName ( ) const

Return the name of the identity.

Definition at line 35 of file identity.cpp.

◆ operator bool()

ndn::security::pib::Identity::operator bool ( ) const
explicitnoexcept

Returns true if the instance is valid.

Definition at line 82 of file identity.cpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Identity id 
)
friend

Definition at line 165 of file identity.hpp.

◆ operator==

bool operator== ( const Identity lhs,
const Identity rhs 
)
friend

Definition at line 160 of file identity.hpp.