none
PFXExportCertStore( ) causes a "Smart Card" pop up window RRS feed

  • Question

  • Hello everyone, 

    I am trying to use PFXExportCertStore in my c++ project to export a PFX certificate from Windows certificate store "MY", but very time when I call PFXExportCertStore, a "Smart card" windows will show and ask me to "Select a smart device". I installed Yubikey Manager and OpenSC and another security token on my machine. How can I control the API to don't show the "smart card" window. Any help will be appreciate. Thanks.

    DWORD dwFlags = EXPORT_PRIVATE_KEYS | REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY | REPORT_NO_PRIVATE_KEY;

    hTempStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, 0, NULL);

    CertAddCertificateContextToStore(

    hTempStore,

    another_cert_context_init_from_my_store,

    CERT_STORE_ADD_REPLACE_EXISTING,

    NULL);

    nullBlob.cbData = 0;

    nullBlob.pbData = NULL;

    BOOL canExportedAsPFX = PFXExportCertStore(hTempStore, &nullBlob, L"", dwFlags); // This statement will cause a "smart card" windows

    • Edited by MartinZhao Monday, September 16, 2019 8:55 AM add windows picture
    Monday, September 16, 2019 8:50 AM