I'm using the NCryptoki dll to manage the acccess to our HSMs.
I use a C# windows service. This service is a socket: it listens for requests and it access to the HSMs, doing stuff.
Using my code to acccess HSM, I randomly get this message:
Cryptware.NCryptoki.CryptokiException: Error n. 145
Only few calls on the total get this message, but it is quite annoying. Do you know why this is happening?
I found 145 is 0x00000091 CKR_OPERATION_NOT_INITIALIZED: There is no active operation of an appropriate type in the specified session
I get this error, for example, when I call the find method:
Cryptware.NCryptoki.CryptokiException: Error n. 145 at Cryptware.NCryptoki.CryptokiObjects.Find(CryptokiCollection attList, Int32 nMaxCount)
It seems like the session isn't valid.
Our service is a listening socket. It gets a big load of requests and, few of them, fail with this message. Do you know why?
The weird point is the same request rarely fails and all the other times works.