Modify the session data to handle the Confidentiality algo
Change-Id: I1be4bb4349a5dfe0a512017cc5ed8f80e5ab14d9
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/session.hpp b/session.hpp
index 87a2276..1eec759 100644
--- a/session.hpp
+++ b/session.hpp
@@ -8,6 +8,7 @@
#include <vector>
#include "auth_algo.hpp"
+#include "crypt_algo.hpp"
#include "integrity_algo.hpp"
#include "endian.hpp"
#include "socket_channel.hpp"
@@ -172,6 +173,35 @@
integrityAlgoInterface = std::move(integrityAlgo);
}
+ /*
+ * @brief Get Session's Confidentiality Algorithm
+ *
+ * @return pointer to the confidentiality algorithm
+ */
+ auto getCryptAlgo() const
+ {
+ if(cryptAlgoInterface)
+ {
+ return cryptAlgoInterface.get();
+ }
+ else
+ {
+ throw std::runtime_error("Confidentiality Algorithm Empty");
+ }
+ }
+
+ /*
+ * @brief Set Session's Confidentiality Algorithm
+ *
+ * @param[in] confAlgo - unique pointer to confidentiality algorithm
+ * instance
+ */
+ void setCryptAlgo(
+ std::unique_ptr<cipher::crypt::Interface>&& cryptAlgo)
+ {
+ cryptAlgoInterface = std::move(cryptAlgo);
+ }
+
void updateLastTransactionTime()
{
lastTime = std::chrono::steady_clock::now();
@@ -212,6 +242,10 @@
std::unique_ptr<cipher::integrity::Interface> integrityAlgoInterface =
nullptr;
+ // Confidentiality Algorithm Interface for the Session
+ std::unique_ptr<cipher::crypt::Interface> cryptAlgoInterface =
+ nullptr;
+
// Last Transaction Time
decltype(std::chrono::steady_clock::now()) lastTime;
};