Sample code for 30+ languages & platforms
Unicode C

Load a Certificate from the Windows Certificate Store

See more Certificates Examples

Demonstrates how to load a certificate that has been pre-installed in the registry-based Windows certificate store. This is generally how one would load a certificate that is stored on a smart card or usb token.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkCertW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkCertW cert;

    success = FALSE;

    cert = CkCertW_Create();

    success = CkCertW_LoadByCommonName(cert,L"PIVKey 7ED53EC611D3F84396212C5842BB563F");
    if (success != TRUE) {
        wprintf(L"%s\n",CkCertW_lastErrorText(cert));
        CkCertW_Dispose(cert);
        return;
    }

    wprintf(L"Loaded: %s\n",CkCertW_subjectDN(cert));


    CkCertW_Dispose(cert);

    }