I'm trying to acquire the Microsoft Smart Card Key Storage Provider using:

CryptAcquireContext(&hProv, contName ,L"Microsoft Smart Card Key Storage Provider", PROV_RSA_FULL , flags);

but, this fails with error: NTE_KEYSET_NOT_DEF (0x80090019)

if I use:

CryptAcquireContext(&hProv, contName ,L" Microsoft Base Smart Card Crypto Provider", PROV_RSA_FULL , flags);

it works. But as far as my knowledge goes the Base Smart Card provider is the provider before CNG was introduced.

So what is the right Provider Name to use the CNG KSP for Smart Cards?

Thanks for your help!

有帮助吗?

解决方案

The problem is that you don't use CryptAcquireContext for CNG providers. To open a CNG provider use NCryptOpenStorageProvider.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top