locked
CertOpenStore with flag CERT_SYSTEM_STORE_CURRENT_SERVICE RRS feed

  • Question

  • Hello 

    I need to load certificates from Service Certificate Store. The program run as a service. I open certificate store with the help of CertOpenStore function with CERT_SYSTEM_STORE_CURRENT_SERVICE flag :

    HCERTSTORE certStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, NULL, CERT_STORE_READONLY_FLAG|CERT_SYSTEM_STORE_CURRENT_SERVICE, L"My");
    PCCERT_CONTEXT pCertContext(NULL);   
    pCertContext = CertEnumCertificatesInStore(certStore, pCertContext);

    In the end pCertContext  is NULL, although there are certificates in the personal "My" Service Store. 
    If I open Service Store with CERT_SYSTEM_STORE_SERVICES flag, all certificates are in place: 

    HCERTSTORE certStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, NULL, CERT_STORE_READONLY_FLAG|CERT_SYSTEM_STORE_SERVICES, L"TestService\\My");
    PCCERT_CONTEXT pCertContext(NULL);   
    pCertContext = CertEnumCertificatesInStore(certStore, pCertContext);

    So what is the problem with CERT_SYSTEM_STORE_CURRENT_SERVICE flag ?
                                                                                            with best regards, Alexey 
    • Moved by Jesse Jiang Tuesday, September 4, 2012 1:40 AM (From:Visual C++ General)
    Monday, September 3, 2012 8:56 AM

All replies

  • Hi ,

    I think your issue should be raised in the Application Security for Windows Desktop. I believe they will know more information of this issue than us, and I will move this one to that forum.

    Thanks for your understanding,

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, September 4, 2012 1:40 AM
  • Up Up
    Monday, September 17, 2012 12:34 PM