32 bit HSM cryptoki on 64 bit Windows

1,968 views
Skip to first unread message

Tim Harvey

unread,
Jun 24, 2014, 3:57:11 AM6/24/14
to pkcs11...@googlegroups.com
Hi

I have started using Pksc11Interop for use on Windows 7 64. I installed the Safenet HSM in 64 bit mode and everything works correctly. 

Now I have to use a third party dll which forces me to compile the program in 32 bit mode. This has caused the Pksc11Interop library to stop working with the error: "%1 is not a valid Win32 application".

I have tried reinstalling the HSM in 32 bit mode and set the path to the 32 bit dll but still this fails with warnings: "Win32Exception: The specified module could not be found". mIssing ethsm.dll.

Can I use Pkcs11Interop in 32 bit mode on a 64 bit OS and if so, what steps do I need to take to configure it correctly?

Thanks in advance

Tim 

tim.har...@gmail.com

unread,
Jun 24, 2014, 4:26:58 AM6/24/14
to pkcs11...@googlegroups.com, tim.har...@gmail.com

Ok, it started working after I installed the 32 bit cryptoki.dll and restarted. Thanks

Jaroslav Imrich

unread,
Jun 29, 2014, 2:39:17 PM6/29/14
to pkcs11...@googlegroups.com, tim.har...@gmail.com
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.

In Visual Studio 2010 target platform can be changed before compilation in the configuration dialog accessible via menu "Build > Configuration Manager...". More information about the platform option of MS C# compiler can be found at MSDN: http://msdn.microsoft.com/en-us/library/zekwfyz4(v=vs.100).aspx

Hope this helps.

--
Kind Regards

Jaroslav Imrich
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages