About CryptoApi and multithreading

A

Aleksey Rechinsky

Hello!

I have to write a cryptographic service provider (CSP) for MS CryptoApi.
I read all of MSDN documentation about it but still can't understand if the
CSP must be multithread-safe.

I'll try to explain in details, i need answers for the following questions:

1) Should i expect that CPAcquireContext() may be called in different thread
contexts?
Namely, should i protect CSP internal handle table for HCRYPTPROV?

2) Should i expect that one HCRYPTPROV may be used in different thread
contexts?
For example is it normal to CryptoApi when one (main) user thread acquires
key context (receives HCRYPTPROV from CryptAcquireContext()) and then worker
threads do some job with it. For example, the first worker thread decrypts a
file, the second - encrypts a message and so on, but with the one
HCRYPTPROV.
In other words, should i protect CSP internal HCRYPTPROV representation from
multithreaded access?

3) All of above for HCRYPTKEY and HCRYPTHASH?

Thanks.
Aleksey.

PS: Sorry for my poor English, i have very small writing practice :-|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top