ndn::security::Identity Class Reference

represents an identity More...

#include <identity.hpp>

Collaboration diagram for ndn::security::Identity:
[legend]

Public Member Functions

 Identity ()
 Default Constructor. More...
 
const NamegetName () const
 Get the name of the identity. More...
 
Key getKey (const name::Component &keyId) const
 Get a key with id keyId. More...
 
const KeyContainergetKeys () const
 Get all the keys for this Identity. More...
 
KeygetDefaultKey () const
 Get the default key for this Identity. More...
 
 operator bool () const
 Check if the Identity instance is valid. More...
 
bool operator! () const
 Check if the Identity instance is invalid. More...
 

Static Public Attributes

static const name::Component EMPTY_KEY_ID
 The default value of keyId when add a new key. More...
 

Friends

class Pib
 
class IdentityContainer
 
class KeyChain
 

Detailed Description

represents an identity

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

Exceptions
PibImpl::Errorwhen underlying implementation has non-semantic error.

Definition at line 44 of file identity.hpp.

Constructor & Destructor Documentation

ndn::security::Identity::Identity ( )

Default Constructor.

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

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

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

Definition at line 31 of file identity.cpp.

Member Function Documentation

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

Get the default key for this Identity.

Exceptions
Pib::Errorif the default key does not exist.

Definition at line 133 of file identity.cpp.

Key ndn::security::Identity::getKey ( const name::Component keyId) const

Get a key with id keyId.

Parameters
keyIdThe id of the key to get.
Exceptions
Pib::Errorif the key does not exist.

Definition at line 93 of file identity.cpp.

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

Get all the keys for this Identity.

Definition at line 101 of file identity.cpp.

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

Get the name of the identity.

Definition at line 53 of file identity.cpp.

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

Check if the Identity instance is valid.

Definition at line 145 of file identity.cpp.

bool ndn::security::Identity::operator! ( ) const

Check if the Identity instance is invalid.

Definition at line 151 of file identity.cpp.

Friends And Related Function Documentation

friend class IdentityContainer
friend

Definition at line 48 of file identity.hpp.

friend class KeyChain
friend

Definition at line 49 of file identity.hpp.

friend class Pib
friend

Definition at line 47 of file identity.hpp.

Field Documentation

const name::Component ndn::security::Identity::EMPTY_KEY_ID
static

The default value of keyId when add a new key.

An empty keyId implies that the key digest should be used as the actual keyId.

Definition at line 177 of file identity.hpp.