ndn::security::pib::Pib Class Reference

represents the PIB More...

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

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

Classes

class  Error
 represents a semantic error More...
 

Public Member Functions

 ~Pib ()
 
const IdentitygetDefaultIdentity () const
 Get the default identity. More...
 
const IdentityContainergetIdentities () const
 Get all the identities. More...
 
Identity getIdentity (const Name &identityName) const
 Get an identity with name identityName. More...
 
std::string getPibLocator () const
 Get PIB Locator. More...
 
std::string getScheme () const
 return the scheme of the PIB Locator More...
 
std::string getTpmLocator () const
 Get TPM Locator. More...
 
void reset ()
 Reset content in PIB, including reset of the TPM locator. More...
 
void setTpmLocator (const std::string &tpmLocator)
 Set the corresponding TPM information to tpmLocator. More...
 

Protected Attributes

Identity m_defaultIdentity
 
IdentityContainer m_identities
 
shared_ptr< PibImplm_impl
 
bool m_isDefaultIdentityLoaded
 
std::string m_location
 
std::string m_scheme
 

Friends

class v2::KeyChain
 

Detailed Description

represents the PIB

The PIB (Public Information Base) stores the public portion of a user's cryptography keys. The format and location of stored information is indicated by the PibLocator. The PIB is designed to work with a TPM (Trusted Platform Module) which stores private keys. There is a one-to-one association between PIB and TPM, and therefore the TpmLocator is recorded by the PIB to enforce this association and prevent one from operating on mismatched PIB and TPM.

Information in the PIB is organized in a hierarchy of Identity-Key-Certificate. At the top level, the Pib class provides access to identities, and allows setting a default identity. Properties of an identity can be accessed after obtaining an Identity object.

Note
Pib instance is created and managed only by v2::KeyChain. v2::KeyChain::getPib() returns a const reference to the managed Pib instance, through which it is possible to retrieve information about identities, keys, and certificates.
Exceptions
PibImpl::Errorwhen underlying implementation has non-semantic error.

Definition at line 52 of file pib.hpp.

Constructor & Destructor Documentation

◆ ~Pib()

ndn::security::pib::Pib::~Pib ( )
default

Member Function Documentation

◆ getDefaultIdentity()

const Identity & ndn::security::pib::Pib::getDefaultIdentity ( ) const

Get the default identity.

Exceptions
Pib::Errorif no default identity exists.

Definition at line 129 of file pib.cpp.

◆ getIdentities()

const IdentityContainer & ndn::security::pib::Pib::getIdentities ( ) const

Get all the identities.

Definition at line 108 of file pib.cpp.

◆ getIdentity()

Identity ndn::security::pib::Pib::getIdentity ( const Name identityName) const

Get an identity with name identityName.

Exceptions
Pib::Errorif the identity does not exist.

Definition at line 100 of file pib.cpp.

◆ getPibLocator()

std::string ndn::security::pib::Pib::getPibLocator ( ) const

Get PIB Locator.

Definition at line 45 of file pib.cpp.

◆ getScheme()

std::string ndn::security::pib::Pib::getScheme ( ) const
inline

return the scheme of the PIB Locator

Definition at line 69 of file pib.hpp.

◆ getTpmLocator()

std::string ndn::security::pib::Pib::getTpmLocator ( ) const

Get TPM Locator.

Exceptions
Errorif TPM locator is empty

Definition at line 61 of file pib.cpp.

◆ reset()

void ndn::security::pib::Pib::reset ( )

Reset content in PIB, including reset of the TPM locator.

Definition at line 71 of file pib.cpp.

◆ setTpmLocator()

void ndn::security::pib::Pib::setTpmLocator ( const std::string &  tpmLocator)

Set the corresponding TPM information to tpmLocator.

If the provided tpmLocator is different from the existing one, PIB will be reset. Otherwise, nothing will be changed.

Definition at line 51 of file pib.cpp.

Friends And Related Function Documentation

◆ v2::KeyChain

friend class v2::KeyChain
friend

Definition at line 177 of file pib.hpp.

Member Data Documentation

◆ m_defaultIdentity

Identity ndn::security::pib::Pib::m_defaultIdentity
mutableprotected

Definition at line 171 of file pib.hpp.

◆ m_identities

IdentityContainer ndn::security::pib::Pib::m_identities
protected

Definition at line 173 of file pib.hpp.

◆ m_impl

shared_ptr<PibImpl> ndn::security::pib::Pib::m_impl
protected

Definition at line 175 of file pib.hpp.

◆ m_isDefaultIdentityLoaded

bool ndn::security::pib::Pib::m_isDefaultIdentityLoaded
mutableprotected

Definition at line 170 of file pib.hpp.

◆ m_location

std::string ndn::security::pib::Pib::m_location
protected

Definition at line 168 of file pib.hpp.

◆ m_scheme

std::string ndn::security::pib::Pib::m_scheme
protected

Definition at line 167 of file pib.hpp.