All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Friends | List of all members
ndn::PibIdentityImpl Class Reference

PibIdentityImpl provides the backend implementation for PibIdentity. More...

#include <pib-identity-impl.hpp>

Public Member Functions

 PibIdentityImpl (const Name &identityName, const ptr_lib::shared_ptr< PibImpl > &pibImpl, bool needInit)
 Create a PibIdentityImpl with identityName. More...
 
const NamegetName ()
 
ptr_lib::shared_ptr< PibKeyaddKey (const uint8_t *key, size_t keyLength, const Name &keyName)
 Add the key. More...
 
void removeKey (const Name &keyName)
 Remove the key with keyName and its related certificates. More...
 
ptr_lib::shared_ptr< PibKeygetKey (const Name &keyName)
 Get the key with name keyName. More...
 
ptr_lib::shared_ptr< PibKey > & setDefaultKey (const Name &keyName)
 Set the key with name keyName as the default key of the identity. More...
 
ptr_lib::shared_ptr< PibKey > & setDefaultKey (const uint8_t *key, size_t keyLength, const Name &keyName)
 Add a key with name keyName and set it as the default key of the identity. More...
 
ptr_lib::shared_ptr< PibKey > & getDefaultKey ()
 Get the default key of this Identity. More...
 

Friends

class PibIdentity
 

Detailed Description

PibIdentityImpl provides the backend implementation for PibIdentity.

A PibIdentity has only one backend instance, but may have multiple frontend handles. Each frontend handle is associated with the only one backend PibIdentityImpl.

Constructor & Destructor Documentation

ndn::PibIdentityImpl::PibIdentityImpl ( const Name identityName,
const ptr_lib::shared_ptr< PibImpl > &  pibImpl,
bool  needInit 
)

Create a PibIdentityImpl with identityName.

Parameters
identityNameThe name of the identity, which is copied.
pibImplThe Pib backend implementation.
needInitIf true and the identity does not exist in the pibImpl back end, then create it (and If no default identity has been set, identityName becomes the default). If false, then throw Pib::Error if the identity does not exist in the pibImpl back end.
Exceptions
Pib::Errorif the identity does not exist in the pibImpl back end and needInit is false.

Member Function Documentation

ptr_lib::shared_ptr< PibKey > ndn::PibIdentityImpl::addKey ( const uint8_t *  key,
size_t  keyLength,
const Name keyName 
)

Add the key.

If a key with the same name already exists, overwrite the key. If no default key for the identity has been set, then set the added key as default for the identity.

Parameters
keyThe public key bits. This copies the array.
keyLengthThe length of the public key bits array.
keyNameThe name of the key. This copies the name.
Returns
The PibKey object.
ptr_lib::shared_ptr< PibKey > & ndn::PibIdentityImpl::getDefaultKey ( )

Get the default key of this Identity.

Returns
The default PibKey.
Exceptions
Pib::Errorif the default key has not been set.
ptr_lib::shared_ptr< PibKey > ndn::PibIdentityImpl::getKey ( const Name keyName)

Get the key with name keyName.

Parameters
keyNameThe name of the key.
Returns
The PibKey object.
Exceptions
std::invalid_argumentif keyName does not match the identity name.
Pib::Errorif the key does not exist.
void ndn::PibIdentityImpl::removeKey ( const Name keyName)

Remove the key with keyName and its related certificates.

If the key does not exist, do nothing.

Parameters
keyNameThe name of the key.
ptr_lib::shared_ptr< PibKey > & ndn::PibIdentityImpl::setDefaultKey ( const Name keyName)

Set the key with name keyName as the default key of the identity.

Parameters
keyNameThe name of the key. This copies the name.
Returns
The PibKey object of the default key.
Exceptions
std::invalid_argumentif the name of the key does not match the identity name.
Pib::Errorif the key does not exist.
ptr_lib::shared_ptr< PibKey > & ndn::PibIdentityImpl::setDefaultKey ( const uint8_t *  key,
size_t  keyLength,
const Name keyName 
)

Add a key with name keyName and set it as the default key of the identity.

Parameters
keyThe array of encoded key bytes.
keyLengthThe number of bytes in the key array.
keyNameThe name of the key, which is copied.
Returns
The PibKey object of the default key.
Exceptions
std::invalid_argumentif the name of the key does not match the identity name.
Pib::Errorif a key with the same name already exists.

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