NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::security::pib::Identity Class Reference

A frontend handle of an Identity. More...

#include <identity.hpp>

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

Public Member Functions

 Identity ()
 Default Constructor. More...
 
 Identity (weak_ptr< detail::IdentityImpl > impl)
 Create an Identity with a backend implementation impl. More...
 
const NamegetName () const
 Get the name of the identity. More...
 
Key getKey (const Name &keyName) const
 Get a key with id keyName. More...
 
const KeyContainergetKeys () const
 Get all keys for this identity. More...
 
const KeygetDefaultKey () const
 Get the default key for this Identity. More...
 
 operator bool () const
 
void removeKey (const Name &keyName) const
 Remove a key with keyName. More...
 
const KeysetDefaultKey (const Name &keyName) const
 Set an existing key with keyName as the default key. More...
 
const KeysetDefaultKey (const uint8_t *key, size_t keyLen, const Name &keyName) const
 Add a key of keyLen bytes with keyName and set it as the default key. More...
 

Public Attributes

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE __pad0__: Key addKey(const uint8_t* key
 
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE size_t keyLen
 
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE size_t const Name &keyName const
 

Friends

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

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

◆ getName()

◆ 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.

Referenced by ndn::security::v2::KeyChain::importSafeBag().

◆ getKeys()

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

Get all keys for this identity.

Definition at line 61 of file identity.cpp.

Referenced by ndn::security::v2::KeyChain::deleteIdentity().

◆ 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.

◆ 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.

◆ removeKey()

void ndn::security::pib::Identity::removeKey ( const Name keyName) const

Remove a key with keyName.

Exceptions
std::invalid_argumentkeyName does not match identity

Definition at line 49 of file identity.cpp.

Referenced by ndn::security::v2::KeyChain::deleteKey().

◆ setDefaultKey() [1/2]

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

Set an existing key with keyName as the default key.

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

Definition at line 67 of file identity.cpp.

Referenced by ndn::security::v2::KeyChain::setDefaultKey().

◆ setDefaultKey() [2/2]

const Key & ndn::security::pib::Identity::setDefaultKey ( const uint8_t *  key,
size_t  keyLen,
const Name keyName 
) const

Add a key of keyLen bytes with keyName and set it as the default key.

Exceptions
std::invalid_argumentkeyName does not match identity
Pib::Errorthe key with the same name already exists.
Returns
the default key

Definition at line 73 of file identity.cpp.

References keyLen.

Friends And Related Function Documentation

◆ v2::KeyChain

friend class v2::KeyChain
friend

Definition at line 154 of file identity.hpp.

◆ operator!=

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

Definition at line 101 of file identity.cpp.

Member Data Documentation

◆ __pad0__

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::security::pib::Identity::__pad0__

Definition at line 106 of file identity.hpp.

◆ keyLen

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE size_t ndn::security::pib::Identity::keyLen

Definition at line 115 of file identity.hpp.

Referenced by setDefaultKey().

◆ const

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE size_t const Name& keyName ndn::security::pib::Identity::const

Definition at line 115 of file identity.hpp.


The documentation for this class was generated from the following files: