diff options
Diffstat (limited to 'SoftHSMv2/src/lib/session_mgr')
-rw-r--r-- | SoftHSMv2/src/lib/session_mgr/Session.cpp | 19 | ||||
-rw-r--r-- | SoftHSMv2/src/lib/session_mgr/Session.h | 6 |
2 files changed, 25 insertions, 0 deletions
diff --git a/SoftHSMv2/src/lib/session_mgr/Session.cpp b/SoftHSMv2/src/lib/session_mgr/Session.cpp index 5db36fd..54c0ff7 100644 --- a/SoftHSMv2/src/lib/session_mgr/Session.cpp +++ b/SoftHSMv2/src/lib/session_mgr/Session.cpp @@ -58,6 +58,9 @@ Session::Session(Slot* inSlot, bool inIsReadWrite, CK_VOID_PTR inPApplication, C symmetricKey = NULL; param = NULL; paramLen = 0; + + // Storing Key handle in session + hKey = CK_INVALID_HANDLE; } // Constructor @@ -85,6 +88,9 @@ Session::Session() symmetricKey = NULL; param = NULL; paramLen = 0; + + // Storing Key handle in session + hKey = CK_INVALID_HANDLE; } // Destructor @@ -93,6 +99,19 @@ Session::~Session() resetOp(); } +void Session::setKeyHandle(CK_OBJECT_HANDLE inHKey) +{ + //store the key hanldle for subsequent use + hKey = inHKey; +} + + +CK_OBJECT_HANDLE Session::getKeyHandle() +{ + //return the Key handle for subsequent use + return hKey; +} + // Get session info CK_RV Session::getInfo(CK_SESSION_INFO_PTR pInfo) { diff --git a/SoftHSMv2/src/lib/session_mgr/Session.h b/SoftHSMv2/src/lib/session_mgr/Session.h index 142aaa5..128fb2b 100644 --- a/SoftHSMv2/src/lib/session_mgr/Session.h +++ b/SoftHSMv2/src/lib/session_mgr/Session.h @@ -124,6 +124,9 @@ public: void setSymmetricKey(SymmetricKey* inSymmetricKey); SymmetricKey* getSymmetricKey(); + void setKeyHandle(CK_OBJECT_HANDLE inHKey); + CK_OBJECT_HANDLE getKeyHandle(); + private: // Constructor Session(); @@ -170,6 +173,9 @@ private: // Symmetric Crypto SymmetricKey* symmetricKey; + + // Storing Key handle in session + CK_OBJECT_HANDLE hKey; }; #endif // !_SOFTHSM_V2_SESSION_H |