locked
CryptAcquireContext intermittently hangs in a Custom v1 Credential Provider for Contacted Smart Card RRS feed

  • Question

  • In my custom Windows v1 Credential Provider, during the call to ICredentialProvider::SetUsageScenario, I collect Smart card information - discover cards inserted, connect to the card, get the ATR and CSP provider. Then when I call CryptAcquireContext, using the reader as the default container (in preparation to enumerate the card for the containers and certificates), the machine hangs. If I remove the smart card that corresponds to the CryptAcquireContext call, the call aborts. This does not happen all of the time - it is intermittent. I do not understand what could cause CryptAcquireContext to hang. My CP Filter is removing all other credential providers, so I do not know what other process can be holding the smart card to prevent me from accessing it.

    Joseph J Eremita

    • Moved by Shu 2017 Wednesday, August 19, 2015 7:06 AM from VC++ forum
    Tuesday, August 18, 2015 1:50 PM

All replies

  • Update: This problem seems to occur ONLY on Windows 7. I have never observed it on Windows 8.1 nor Windows 10. In addition, sometimes my Credential Provider hangs at the call to SCardConnect. I have also observed that initially when I wait for a change in the SC status - from setting the state to SCARD_STATE_UNAWARE, to getting SCARD_STATE_PRESENT, I am also seeing the SCARD_STATE_INUSE bit as set. Who else is accessing this card at this time since my Filter is filtering out all other providers? The one provider that is not presented in the list passed to my filter is the MS SC provider; however, it is listed in the registry.

    Joseph J Eremita

    Thursday, September 3, 2015 1:39 PM
  • New information: If I remove the MS Smart Card Credential Provider from the registry, my provider NEVER HANGS! I have a filter, however, my filter does not get the MS Smart Card Credential Provider in the list of providers it can filter. Therefore, I assume that Microsoft is not allowing other Credential Providers from filtering their Smart Card Credential Provider! This behavior does NOT happen with Windows 8.1. The MS Smart Card Credential Provider IS in the list of providers that my filter is presented, and therefore, I do filter it. That is why I see a hang ONLY on Windows 7!



    Joseph J Eremita

    Monday, September 14, 2015 6:29 PM