Object PKCS#11 C++ Wrapper
Cryptoki.h
Go to the documentation of this file.
1 #ifndef CRYPTOKI_H
2 #define CRYPTOKI_H
3 
4 #include <string>
5 #include <cstring>
6 #include <dlfcn.h>
7 
8 #include "pkcs11.h"
9 #include "CryptokiException.h"
10 #include "macros.h"
11 #include "Info.h"
12 #include "Session.h"
13 #include "SessionInfo.h"
14 
15 namespace objck {
16 typedef CK_FUNCTION_LIST FunctionList;
17 typedef CK_NOTIFY CryptokiNotify;
18 
33 class Cryptoki
34 {
35 public:
36 
37  Cryptoki(const std::string& path);
38 
39  virtual ~Cryptoki();
40 
48  void initialize();
49 
53  Info getInfo();
54 
58  FunctionList getFunctionList();
68  void initToken(unsigned int slot, std::string& soPin, std::string& label);
91  Session openSession(unsigned int slot,
93  CryptokiNotify* notify = 0, void* appPtr = 0);
94 
102  void closeAllSessions(unsigned int slot);
103 
106 protected:
111  void loadModule(const std::string& path);
112 
117  void closeModule();
118 
125  void loadFunctions();
126 
127 
135  void finalize();
138  void* _module;
139  CK_FUNCTION_LIST_PTR _functionList;
140 };
141 }/*END NAMESPACE*/
142 #endif /*CRYPTOKI_H*/
Info getInfo()
Definition: Cryptoki.cpp:64
virtual ~Cryptoki()
Definition: Cryptoki.cpp:12
void loadModule(const std::string &path)
Definition: Cryptoki.cpp:22
void finalize()
Definition: Cryptoki.cpp:57
void closeAllSessions(unsigned int slot)
Definition: Cryptoki.cpp:132
Session openSession(unsigned int slot, SessionInfo::SessionFlags flags=SessionInfo::SERIAL_SESSION, CryptokiNotify *notify=0, void *appPtr=0)
Definition: Cryptoki.cpp:113
CK_FUNCTION_LIST FunctionList
Definition: Cryptoki.h:16
Definition: SessionInfo.h:34
FunctionList getFunctionList()
Definition: Cryptoki.cpp:78
void initialize()
Definition: Cryptoki.cpp:45
SessionFlags
Definition: SessionInfo.h:30
void loadFunctions()
Definition: Cryptoki.cpp:33
void initToken(unsigned int slot, std::string &soPin, std::string &label)
Definition: Cryptoki.cpp:94
PKCS#11 Info
Definition: Info.h:21
PKCS#11 Sessions
Definition: Session.h:26
CK_FUNCTION_LIST_PTR _functionList
Definition: Cryptoki.h:139
CK_NOTIFY CryptokiNotify
Definition: Cryptoki.h:17
Definition: Cryptoki.h:15
Cryptoki(const std::string &path)
Definition: Cryptoki.cpp:5
Cryptoki API
Definition: Cryptoki.h:33
void * _module
Definition: Cryptoki.h:138