none
Minidriver smartcard detection error: The smart card you are using may be missing required driver software or a required certificate RRS feed

  • Question

  • I'm developing a smartcard minidriver (according to version 7 spec.) in windows 7, I want to create a new keyset on my empty card with this command:

    CryptAcquireContext(&hProv, NULL, TEXT("Microsoft Base Smart Card Crypto Provider"), PROV_RSA_FULL, CRYPT_NEWKEYSET)

    but the smartcard selection dialog appears & it shows the followind message for my card & I can't select reader & continue the operation:

    A smart card was detected but is not the one required for the current operation.
    The smart card you are using may be missing required driver software or a required certificate.


    Since my card is empty, it returns an empty buffer (with length 0) while reading cmapfile &
    for cardcf it returns a zero-filled buffer with length 6. The file system structure is created &
    tested successfully & I'm sure everything is OK, also my dll & functions are loading correctly,
    here is sequence of calls:

    CardAcquireContext CardGetProperty (CP_CARD_GUID) CardReadFile (cardcf) CardGetProperty (CP_SUPPORTS_WIN_X509_ENROLLMENT) CardGetProperty (CP_CARD_FREE_SPACE) CardReadFile (cmapfile) CardGetProperty (CP_CARD_PIN_INFO)

    after getting CP_CARD_PIN_INFO property, it again calls CardAcquireContext,
    seems there is a problem with this property. here is the filling code for that:

    if(dwFlags == ROLE_USER)   {
                p->PinType = AlphaNumericPinType;
                p->dwFlags = 0;
                p->PinPurpose = DigitalSignaturePin;
                p->PinCachePolicy.dwVersion = PIN_CACHE_POLICY_CURRENT_VERSION;
                p->PinCachePolicy.dwPinCachePolicyInfo = 0;
                p->PinCachePolicy.PinCachePolicyType = PinCacheNormal;
                p->dwChangePermission = CREATE_PIN_SET(ROLE_USER);
                p->dwUnblockPermission = CREATE_PIN_SET(ROLE_ADMIN);
    }else {...}

    and program always enters above if condition.
    As another note, when I pass CRYPT_DEFAULT_CONTAINER_OPTIONAL instead of CRYPT_NEWKEYSET in CryptAcquireContext function it works fine, but I need to create the key container when acquiring context & I don't know why I give this error!



    Wednesday, July 16, 2014 8:42 AM

Answers