Commit 694e1f20 authored by Alberto Inch's avatar Alberto Inch
Browse files

Add windows support.

parent 8aaf9533
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="changepin" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/changepin" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/changepin" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
<Add directory="C:/Program Files/BellSoft/LibericaJDK-15-Full/include" />
<Add directory="C:/Program Files/BellSoft/LibericaJDK-15-Full/include/win32" />
</Compiler>
<Unit filename="include/Token.h" />
<Unit filename="main.cpp" />
<Unit filename="main.h" />
<Unit filename="src/Token.cpp" />
<Extensions />
</Project>
</CodeBlocks_project_file>
#include <cstring>
#include <sstream>
#include <dlfcn.h>
#include <pkcs11-helper-1.0/pkcs11.h>
class Token
{
public:
Token(const char* lib);
CK_ULONG nroSlots();
CK_SLOT_ID_PTR slots();
CK_SESSION_HANDLE open(CK_SLOT_ID slot);
void close(CK_SESSION_HANDLE hSession);
void changePin(CK_SESSION_HANDLE hSession, const char* oldPin, const char* newPin);
virtual ~Token();
protected:
void* dlHandle;
CK_FUNCTION_LIST_PTR functionList;
char* byteToHex(CK_BYTE_PTR bytes, int l);
char* byteToChar(CK_BYTE_PTR bytes, int l);
void error(CK_RV rv);
private:
};
#include <cstring>
#include <sstream>
#if _WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif // _WIN32
#include "../include/pkcs11.h"
class Token
{
public:
Token(const char* lib);
CK_ULONG nroSlots();
CK_SLOT_ID_PTR slots();
CK_SESSION_HANDLE open(CK_SLOT_ID slot);
void close(CK_SESSION_HANDLE hSession);
void changePin(CK_SESSION_HANDLE hSession, const char* oldPin, const char* newPin);
virtual ~Token();
protected:
#ifdef _WIN32
HMODULE dlHandle;
#else
void* dlHandle;
#endif // _WIN32
CK_FUNCTION_LIST_PTR functionList;
char* byteToHex(CK_BYTE_PTR bytes, int l);
char* byteToChar(CK_BYTE_PTR bytes, int l);
void error(CK_RV rv);
private:
};
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment