Changing logic in GroupManger.getGroupKey() to avoid regenerate group key pairs every time.

Change-Id: I4c6eb5246bce04289d7ba097a66d0f11745ce44c
Refs: #3812
diff --git a/src/group-manager.hpp b/src/group-manager.hpp
index e4674df..2e19ab1 100644
--- a/src/group-manager.hpp
+++ b/src/group-manager.hpp
@@ -62,14 +62,17 @@
    *
    * This method creates a group key if it does not
    * exist, and encrypts the key using public key of
-   * all eligible members
+   * all eligible members.
+   *
+   * @p needRegenerate should be true if 1.first time to call 2.a member was removed
+   *                   and it can be false if 1.not the first time to call 2.a member was added
    *
    * @returns The group key (the first one is the
    *          public key, and the rest are encrypted
    *          private key.
    */
   std::list<Data>
-  getGroupKey(const TimeStamp& timeslot);
+  getGroupKey(const TimeStamp& timeslot, bool needRegenerate = true);
 
   /// @brief Add @p schedule with @p scheduleName
   void
@@ -95,6 +98,7 @@
   void
   updateMemberSchedule(const Name& identity, const std::string& scheduleName);
 
+
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
   /**
    * @brief Calculate interval that covers @p timeslot
@@ -121,6 +125,22 @@
   createDKeyData(const std::string& startTs, const std::string& endTs, const Name& keyName,
                  const Buffer& priKeyBuf, const Buffer& certKey);
 
+  /// @brief Add a EKey to the database
+  void
+  addEKey(const Name& eKeyName, const Buffer& pubKey, const Buffer& priKey);
+
+  /// @brief Get the key pair from the database
+  std::tuple<Buffer, Buffer>
+  getEKey(const Name& eKeyName);
+
+  /// @brief Delete a EKey to the database
+  void
+  deleteEKey(const Name& eKeyName);
+
+  /// @brief The method should be called periodically because the table size will keep growing
+  void
+  cleanEKeys();
+
 private:
   Name m_namespace;
   GroupManagerDB m_db;