sg1
sg1

Reputation: 485

Identifying CSP provider in CryptoAPI

I am using MS CAPI APIs for using a USB token for digital signing.

using CryptAcquireContext, I can print out the names of all the CSPs available, but how do I know which CSP is associated with a plugged-in USB token?

Moreover, what if there are multiple tokens plugged into the computer?

How is the application supposed to choose a CSP?

Upvotes: 1

Views: 705

Answers (1)

Pavel Ognev
Pavel Ognev

Reputation: 982

There are no relationship between smart card or token and cryptographic provider in Windows CAPI. Moreover, same token can be supported by several providers.

There is a good practice for smart card and token developers to implement a "smart card minidriver" for "Microsoft base smart card crypto provider". But it is not obligatorily.

UPD: If several tokens are plugged into PC, you need to manually set "smart card reader" property to provider. List of available readers can be got by SCardListReaders function.

Also, some providers can mix keys from all readers in a single pool.

Upvotes: 1

Related Questions