public class GroupManager extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
GroupManager.Friend
A class implements Friend if it has a method setGroupManagerFriendAccess
which setFriendAccess calls to set the FriendAccess object.
|
static class |
GroupManager.FriendAccess
A friend class can call the methods of FriendAccess to access private
methods.
|
| Constructor and Description |
|---|
GroupManager(Name prefix,
Name dataType,
GroupManagerDb database,
int keySize,
int freshnessHours,
KeyChain keyChain)
Create a group manager with the given values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMember(String scheduleName,
Data memberCertificate)
Add a new member with the given memberCertificate into a schedule named
scheduleName.
|
void |
addSchedule(String scheduleName,
Schedule schedule)
Add a schedule with the given scheduleName.
|
void |
cleanEKeys()
Delete all the EKeys in the database.
|
void |
deleteSchedule(String scheduleName)
Delete the schedule with the given scheduleName.
|
List |
getGroupKey(double timeSlot)
Call the main getGroupKey where needRegenerate is default true.
|
List |
getGroupKey(double timeSlot,
boolean needRegenerate)
Create a group key for the interval into which timeSlot falls.
|
void |
removeMember(Name identity)
Remove a member with the given identity name.
|
static void |
setFriendAccess(GroupManager.Friend friend)
Call friend.setGroupManagerFriendAccess to pass an instance of
a FriendAccess class to allow a friend class to call private methods.
|
void |
updateMemberSchedule(Name identity,
String scheduleName)
Change the name of the schedule for the given member's identity name.
|
void |
updateSchedule(String scheduleName,
Schedule schedule)
Update the schedule with scheduleName and replace the old object with the
given schedule.
|
public GroupManager(Name prefix, Name dataType, GroupManagerDb database, int keySize, int freshnessHours, KeyChain keyChain) throws SecurityException
prefix - The prefix for the group manager namespace.dataType - The data type for the group manager namespace.database - The GroupManagerDb for storing the group management
information (including user public keys and schedules).keySize - The group key will be an RSA key with keySize bits.freshnessHours - The number of hours of the freshness period of data
packets carrying the keys.keyChain - The KeyChain to use for signing data packets. This signs
with the default identity.SecurityExceptionpublic final List getGroupKey(double timeSlot, boolean needRegenerate) throws GroupManagerDb.Error, SecurityException, TpmBackEnd.Error, PibImpl.Error, KeyChain.Error
timeSlot - The time slot to cover as milliseconds since Jan 1, 1970 UTC.needRegenerate - needRegenerate 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.GroupManagerDb.Error - for a database error.SecurityException - for an error using the security KeyChain.TpmBackEnd.ErrorPibImpl.ErrorKeyChain.Errorpublic final List getGroupKey(double timeSlot) throws GroupManagerDb.Error, SecurityException, TpmBackEnd.Error, PibImpl.Error, KeyChain.Error
public final void addSchedule(String scheduleName, Schedule schedule) throws GroupManagerDb.Error
scheduleName - The name of the schedule. The name cannot be empty.schedule - The Schedule to add.GroupManagerDb.Error - if a schedule with the same name already exists,
if the name is empty, or other database error.public final void deleteSchedule(String scheduleName) throws GroupManagerDb.Error
scheduleName - The name of the schedule.GroupManagerDb.Error - for a database error.public final void updateSchedule(String scheduleName, Schedule schedule) throws GroupManagerDb.Error
scheduleName - The name of the schedule. The name cannot be empty.schedule - The Schedule to update or add.GroupManagerDb.Error - if the name is empty, or other database error.public final void addMember(String scheduleName, Data memberCertificate) throws GroupManagerDb.Error, DerDecodingException
scheduleName - The schedule name.memberCertificate - The member's certificate.GroupManagerDb.Error - If there's no schedule named scheduleName, if
the member's identity name already exists, or other database error.DerDecodingException - for error decoding memberCertificate as a
certificate.public final void removeMember(Name identity) throws GroupManagerDb.Error
identity - The member's identity name.GroupManagerDb.Error - for a database error.public final void updateMemberSchedule(Name identity, String scheduleName) throws GroupManagerDb.Error
identity - The member's identity name.scheduleName - The new schedule name.GroupManagerDb.Error - if there's no member with the given identity
name in the database, or there's no schedule named scheduleName.public void cleanEKeys()
throws GroupManagerDb.Error
GroupManagerDb.Error - for a database error.public static void setFriendAccess(GroupManager.Friend friend)
friend - The friend class for calling setGroupManagerFriendAccess.
This uses friend.getClass() to make sure that it is a friend class.
Therefore, only a friend class gets an implementation of FriendAccess.Copyright © 2019. All rights reserved.