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

A GroupManager manages keys and schedules for group members in a particular namespace. More...

#include <group-manager.hpp>

Public Member Functions

 GroupManager (const Name &prefix, const Name &dataType, const ptr_lib::shared_ptr< GroupManagerDb > &database, uint32_t keySize, int freshnessHours, KeyChain *keyChain)
 Create a group manager with the given values. More...
 
void getGroupKey (MillisecondsSince1970 timeSlot, std::vector< ptr_lib::shared_ptr< Data > > &result, bool needRegenerate=true)
 Create a group key for the interval into which timeSlot falls. More...
 
void addSchedule (const std::string &scheduleName, const Schedule &schedule)
 Add a schedule with the given scheduleName. More...
 
void deleteSchedule (const std::string &scheduleName)
 Delete the schedule with the given scheduleName. More...
 
void updateSchedule (const std::string &scheduleName, const Schedule &schedule)
 Update the schedule with scheduleName and replace the old object with the given schedule. More...
 
void addMember (const std::string &scheduleName, const Data &memberCertificate)
 Add a new member with the given memberCertificate into a schedule named scheduleName. More...
 
void removeMember (const Name &identity)
 Remove a member with the given identity name. More...
 
void updateMemberSchedule (const Name &identity, const std::string &scheduleName)
 Change the name of the schedule for the given member's identity name. More...
 
void cleanEKeys ()
 Delete all the EKeys in the database. More...
 

Detailed Description

A GroupManager manages keys and schedules for group members in a particular namespace.

Note
This class is an experimental feature. The API may change.

Constructor & Destructor Documentation

ndn::GroupManager::GroupManager ( const Name prefix,
const Name dataType,
const ptr_lib::shared_ptr< GroupManagerDb > &  database,
uint32_t  keySize,
int  freshnessHours,
KeyChain keyChain 
)

Create a group manager with the given values.

The group manager namespace is /{prefix}/read/{dataType} .

Parameters
prefixThe prefix for the group manager namespace.
dataTypeThe data type for the group manager namespace.
databaseThe GroupManagerDb for storing the group management information (including user public keys and schedules).
keySizeThe group key will be an RSA key with keySize bits.
freshnessHoursThe number of hours of the freshness period of data packets carrying the keys.
keyChainThe KeyChain to use for signing data packets. This signs with the default identity. This is only a pointer to a KeyChain object which must remain valid for the life of this GroupManager.

Member Function Documentation

void ndn::GroupManager::addMember ( const std::string &  scheduleName,
const Data memberCertificate 
)
inline

Add a new member with the given memberCertificate into a schedule named scheduleName.

If cert is an IdentityCertificate made from memberCertificate, then the member's identity name is cert.getPublicKeyName().getPrefix(-1).

Parameters
scheduleNameThe schedule name.
memberCertificateThe member's certificate.
Exceptions
GroupManagerDb::ErrorIf there's no schedule named scheduleName, if the member's identity name already exists, or other database error.
DerDecodingExceptionfor error decoding memberCertificate as a certificate.
void ndn::GroupManager::addSchedule ( const std::string &  scheduleName,
const Schedule schedule 
)
inline

Add a schedule with the given scheduleName.

Parameters
scheduleNameThe name of the schedule. The name cannot be empty.
scheduleThe Schedule to add.
Exceptions
GroupManagerDb::Errorif a schedule with the same name already exists, if the name is empty, or other database error.
void ndn::GroupManager::cleanEKeys ( )
inline

Delete all the EKeys in the database.

The database will keep growing because EKeys will keep being added, so this method should be called periodically.

Exceptions
GroupManagerDb::Errorfor a database error.
void ndn::GroupManager::deleteSchedule ( const std::string &  scheduleName)
inline

Delete the schedule with the given scheduleName.

Also delete members which use this schedule. If there is no schedule with the name, then do nothing.

Parameters
scheduleNameThe name of the schedule.
Exceptions
GroupManagerDb::Errorfor a database error.
void ndn::GroupManager::getGroupKey ( MillisecondsSince1970  timeSlot,
std::vector< ptr_lib::shared_ptr< Data > > &  result,
bool  needRegenerate = true 
)

Create a group key for the interval into which timeSlot falls.

This creates a group key if it doesn't exist, and encrypts the key using the public key of each eligible member.

Parameters
timeSlotThe time slot to cover as milliseconds since Jan 1, 1970 UTC.
resultThis clears result and sets it to a List of Data packets where the first is the E-KEY data packet with the group's public key and the rest are the D-KEY data packets with the group's private key encrypted with the public key of each eligible member.
needRegenerateneedRegenerate (optional) should be true if this is the first time this method is called, or a member was removed. needRegenerate can be false if this is not the first time this method is called, or a member was added. If omitted, use true.
Exceptions
GroupManagerDb::Errorfor a database error.
SecurityExceptionfor an error using the security KeyChain.
void ndn::GroupManager::removeMember ( const Name identity)
inline

Remove a member with the given identity name.

If there is no member with the identity name, then do nothing.

Parameters
identityThe member's identity name.
Exceptions
GroupManagerDb::Errorfor a database error.
void ndn::GroupManager::updateMemberSchedule ( const Name identity,
const std::string &  scheduleName 
)
inline

Change the name of the schedule for the given member's identity name.

Parameters
identityThe member's identity name.
scheduleNameThe new schedule name.
Exceptions
GroupManagerDb::Errorif there's no member with the given identity name in the database, or there's no schedule named scheduleName.
void ndn::GroupManager::updateSchedule ( const std::string &  scheduleName,
const Schedule schedule 
)
inline

Update the schedule with scheduleName and replace the old object with the given schedule.

Otherwise, if no schedule with name exists, a new schedule with name and the given schedule will be added to database.

Parameters
scheduleNameThe name of the schedule. The name cannot be empty.
scheduleThe Schedule to update or add.
Exceptions
GroupManagerDb::Errorif the name is empty, or other database error.

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