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

A frontend handle of an Identity. More...

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

Public Member Functions

 Identity ()
 Default Constructor. More...
 
 Identity (weak_ptr< detail::IdentityImpl > impl)
 Create an Identity with a backend implementation impl. More...
 
const Key & getDefaultKey () const
 Get the default key for this Identity. More...
 
Key getKey (const Name &keyName) const
 Get a key with id keyName. More...
 
const KeyContainer & getKeys () const
 Get all keys for this identity. More...
 
const Name & getName () const
 Get the name of the identity. More...
 
 operator bool () const
 

Friends

bool operator!= (const Identity &, const Identity &)
 
class v2::KeyChain
 

Detailed Description

A frontend handle of an Identity.

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 this identity. Properties of a key can be accessed after obtaining a Key object.

Definition at line 42 of file identity.hpp.

Constructor & Destructor Documentation

◆ Identity() [1/2]

ndn::security::pib::Identity::Identity ( )
default

Default Constructor.

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

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

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

◆ Identity() [2/2]

ndn::security::pib::Identity::Identity ( weak_ptr< detail::IdentityImpl >  impl)
explicit

Create an Identity with a backend implementation impl.

This method should only be used by IdentityContainer.

Definition at line 31 of file identity.cpp.

Member Function Documentation

◆ getDefaultKey()

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

Get the default key for this Identity.

Exceptions
Pib::Errorthe default key does not exist.

Definition at line 79 of file identity.cpp.

◆ getKey()

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

Get a key with id keyName.

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

Definition at line 55 of file identity.cpp.

◆ getKeys()

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

Get all keys for this identity.

Definition at line 61 of file identity.cpp.

◆ getName()

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

Get the name of the identity.

Definition at line 37 of file identity.cpp.

◆ operator bool()

ndn::security::pib::Identity::operator bool ( ) const
explicit
Returns
True if the identity instance is valid

Definition at line 84 of file identity.cpp.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Identity &  ,
const Identity &   
)
friend

Definition at line 101 of file identity.cpp.

◆ v2::KeyChain

friend class v2::KeyChain
friend

Definition at line 154 of file identity.hpp.