0

Trying to write a simple program to try out PKCS #11 with a software based HSM.

Using Windows 10, Visual Studio, and C++.

I downloaded the pkcs header files and have #include "pkcs11.h" at the top of my code.

I have also copied the "softhsm2.dll" file to System32 and SysWOW64 .

However, if I try to use "C_Initialize(NULL)" or any other PKCS#11 function, when I compile I receive the error:

LNK2019 unresolved external symbol in function...

and pointing to the PKCS#11 function.

What am I missing? Do I need to link to the DLL within Visual Studio?

Thanks.

qin__23

Nick
  • 1
  • 1
  • You need to include the `.lib` file(s) in your project. This has nothing to do with the DLL's. DLL's are not used in the build process of your application. Also, your application compiled successfully, so it has nothing to do with header files. If you look at the error, it is a *linker* error, not a compile error. – PaulMcKenzie May 04 '20 at 15:14
  • PKCS#11 libraries are developed for use of `LoadLibrary`/`GetProcAddress`. See PKCS#11 [docs](http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.pdf) pages 30-31, 70-71 for `C_GetFunctionList`. – Alexander May 05 '20 at 06:16

0 Answers0