In order to get a crypto context from CryptAcquireContext()
, I need to know the provider name for the smartcard currently in the slot.
According to the documentation, SCardGetCardTypeProviderName()
will do this, but param 2 is the card name, and I can't see how to determine this non-interactively. All the documentation/examples I've seen either harcode a name or rely on SCardUIDlgSelectCard()
, which displays a UI.
Similarly reading around SCardLocateCards()
, although it takes a list of smartcard names (for which I'm populating from SCardListCards()
, it doesn't seem to pass back anything that identifies the name of the smartcard inserted.
I suspect I'm missing something obvious, but I can't see what.
I was missing something.
SCardLocateCards
returns as part of the strucutre the ATR of the smartcard, which can then be used inSCardListCards
:If anyone has a better route forward let me know - I think this is the only way though from what I can see.