CNG Microsoft Smart Card Key Storage Provider AcquireContext

1

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!

c++
smartcard
cng
asked on Stack Overflow Jul 29, 2013 by dominik

1 Answer

1

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

answered on Stack Overflow Jul 31, 2013 by jonmarkf

User contributions licensed under CC BY-SA 3.0