login about faq

Here is the code :

    CkCreateCS ccs;
    ccs.put_ReadOnly(true);

    //  Open the local machine store:
    CkCertStore *cs = 0;
    cs = ccs.OpenRegistryStore("localMachine","SOFTWARE/Microsoft/SystemCertificates/AuthRoot/Certificates");
    if (!(cs == 0 )) {
        CkCert *cert = 0;
        long numCerts;
        numCerts = cs->get_NumCertificates();
        long i;
        //  Print the distinguished name of each certificate
        for (i = 0; i <= numCerts - 1; i++) {
            cert = cs->GetCertificate(i);
            TRACE("%s\n",cert->subjectDN());
            TRACE("%s\n",cert->subjectO());
            delete cert;
        }
        delete cs;
    }
    else {
        TRACE("%s\n",ccs.lastErrorText());
    }

ccs.OpenRegistryStore return true but get_NumCertificates return 0 although I have a lot of certificates I can see through regedit/certmsg.msc.

Where is the problem in this source code ?

Thank you for your help.

asked Mar 05 '14 at 13:34

Chronogps's gravatar image

Chronogps
11


When running certmgr.msc, the certificate stores you will see are for CurrentUser (not LocalMachine). You would need to start the certmgr.msc in a very specific way to see the LocalMachine cert stores.

Try passing "CurrentUser" instead of "localMachine" to OpenRegistryStore.

link

answered Mar 06 '14 at 14:59

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

CurrentUser or LocalMachine : same problem : Always 0. This code works for you ? Did you test it ?

link

answered Mar 06 '14 at 15:27

Chronogps's gravatar image

Chronogps
11

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1

Asked: Mar 05 '14 at 13:34

Seen: 577 times

Last updated: Mar 06 '14 at 15:27

Related questions

powered by OSQA