CryptAcquireContext() fails for Eracom HSM



Hi all

I'm trying to "play" with HSM mentioned, but can't even acquire context.

..NET 1.1 is used with P/Invoke.

The code is:

....
uint provFlags = CRYPT_VERIFYCONTEXT;
if (!CryptAcquireContext(ref pProvider, null, ERACOM_PROVIDER_NAME,
PROV_RSA_FULL, provFlags)) {
ShowWin32Error(Marshal.GetLastWin32Error(), true);
return;
}
....
private static void ShowWin32Error(int errorcode, bool startNewLine) {
Win32Exception myEx = new Win32Exception(errorcode);
if (startNewLine) {
Console.WriteLine();
}
Console.WriteLine("Error code:\t 0x{0:X}", myEx.ErrorCode);
Console.WriteLine("Error message:\t " + myEx.Message);
}


Strange, but this code fails with error 0x80004005 ('Unspecified error' in
WinError.h). Though ShowWin32Error() function shows other error message...

Any ideas?
TIA


.