Object PKCS#11 C++ Wrapper
Session.h
Go to the documentation of this file.
1 #ifndef SESSION_H
2 #define SESSION_H
3 
4 #include "Stateful.h"
5 #include "pkcs11.h"
6 #include "macros.h"
7 #include "CryptokiException.h"
8 #include "SessionInfo.h"
9 
10 namespace objck {
26 class Session : public Stateful
27 {
28  friend class Cryptoki;
29 
30 protected:
31  CK_SESSION_HANDLE _session;
32  CK_FUNCTION_LIST_PTR _functionList;
33 public:
34  Session() : Stateful(), _functionList(0) {};
35  Session(Session&& other) {
36  _session = std::move(other._session);
37  _functionList = std::move(other._functionList);
38  _currentState = other._currentState;
39  other._currentState = DISABLED;
40  };
41  virtual ~Session(){ closeSession(); _functionList = 0;};
42  Session& operator=(const Session& other) = delete;
44  {
45  _session = std::move(other._session);
46  _functionList = std::move(other._functionList);
47  _currentState = other._currentState;
48  other._currentState = DISABLED;
49  return *this;
50  };
51 
58  void getOperationState();
59  void setOperationState();
60  void closeSession();
61 
65  void initPin(std::string& pin);
66 
67 
71  void login(std::string& soPin);
72 
73  CK_SESSION_HANDLE getSessionHandle();
74  void logout();
76 };
77 }/*END NAMESPACE*/
78 #endif /*SESSION_H*/
PKCS#11 Session Info
Definition: SessionInfo.h:21
Session()
Definition: Session.h:34
Definition: Stateful.h:24
void setOperationState()
Definition: Session.cpp:42
CK_FUNCTION_LIST_PTR _functionList
Definition: Session.h:32
Stateful::state _currentState
Definition: Stateful.h:28
void login(std::string &soPin)
Definition: Session.cpp:49
Session & operator=(Session &&other)
Definition: Session.h:43
Session & operator=(const Session &other)=delete
SessionInfo getSessionInfo()
Definition: Session.cpp:19
CK_SESSION_HANDLE _session
Definition: Session.h:31
void getOperationState()
Definition: Session.cpp:35
PKCS#11 Sessions
Definition: Session.h:26
void initPin(std::string &pin)
Definition: Session.cpp:68
virtual ~Session()
Definition: Session.h:41
CK_SESSION_HANDLE getSessionHandle()
Definition: Cryptoki.h:15
void closeSession()
Definition: Session.cpp:4
Session(Session &&other)
Definition: Session.h:35
Cryptoki API
Definition: Cryptoki.h:33
Initializable abstract class
Definition: Stateful.h:16