Sample code for 30+ languages & platforms
Unicode C++

Windows Certificate Stores - Find Certificate by Common Name

See more Certificates Examples

Searches the Windows certificate stores for a certificate that matches the specified common name (CN).

Note: This example requires Chilkat v10.0.0 or greater.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkCertW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkCertW cert;
    success = cert.LoadByCommonName(L"Chilkat Software, Inc.");
    if (success == false) {
        wprintf(L"%s\n",cert.lastErrorText());
        return;
    }

    wprintf(L"%s\n",cert.subjectDN());
    wprintf(L"Success.\n");
    }