Hello Tim,
thanks for using Pkcs11Interop. I am glad you have managed to resolve the issue on your own however I would like to add a little more detailed information about the platform support for future reference as other users may also find it useful:
Pkcs11Interop library is by default compiled with "AnyCPU" platform option which means the same assembly (DLL) can be used in both 32-bit and 64-bit applications. In general .NET assemblies compiled with "AnyCPU" platform option will execute on the same CLR as the process into which it is being loaded. This may be a little hard to understand without previous experience so I'll just add three simple examples that will hopefully make the things clear.
Example #1:
Console application built for "x86" platform references Pkcs11Interop assembly built for "AnyCPU" platform.
On 32-bit OS this application will run in 32-bit mode and will be able to load only 32-bit unmanaged PKCS#11 libraries.
On 64-bit OS this application will also run in 32-bit mode and will be able to load only 32-bit unmanaged PKCS#11 libraries.
Example #2:
Console application built for "x64" platform references Pkcs11Interop assembly built for "AnyCPU" platform.
On 32-bit OS this application will not be running.
On 64-bit OS this application will run in 64-bit mode and will be able to load only 64-bit unmanaged PKCS#11 libraries.
Example #3:
Console application built for "AnyCPU" platform references Pkcs11Interop assembly built for "AnyCPU" platform.
On 32-bit OS this application will run in 32-bit mode and will be able to load only 32-bit unmanaged PKCS#11 libraries.
On 64-bit OS this application will run in 64-bit mode and will be able to load only 64-bit unmanaged PKCS#11 libraries.