From 491dbd0126b10d3a7a1aa0745edd57ac51dab371 Mon Sep 17 00:00:00 2001 From: Tom Joseph Date: Tue, 24 Jan 2017 18:20:41 +0530 Subject: Modify the session data to handle the Confidentiality algo Change-Id: I1be4bb4349a5dfe0a512017cc5ed8f80e5ab14d9 Signed-off-by: Tom Joseph --- session.hpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'session.hpp') diff --git a/session.hpp b/session.hpp index 87a2276..1eec759 100644 --- a/session.hpp +++ b/session.hpp @@ -8,6 +8,7 @@ #include #include "auth_algo.hpp" +#include "crypt_algo.hpp" #include "integrity_algo.hpp" #include "endian.hpp" #include "socket_channel.hpp" @@ -172,6 +173,35 @@ class Session 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&& cryptAlgo) + { + cryptAlgoInterface = std::move(cryptAlgo); + } + void updateLastTransactionTime() { lastTime = std::chrono::steady_clock::now(); @@ -212,6 +242,10 @@ class Session std::unique_ptr integrityAlgoInterface = nullptr; + // Confidentiality Algorithm Interface for the Session + std::unique_ptr cryptAlgoInterface = + nullptr; + // Last Transaction Time decltype(std::chrono::steady_clock::now()) lastTime; }; -- cgit v1.2.1