Sample code for 30+ languages & platforms
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 C Downloads

C
#include <C_CkCert.h>

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

    success = FALSE;

    cert = CkCert_Create();

    success = CkCert_LoadByCommonName(cert,"PIVKey 7ED53EC611D3F84396212C5842BB563F");
    if (success != TRUE) {
        printf("%s\n",CkCert_lastErrorText(cert));
        CkCert_Dispose(cert);
        return;
    }

    printf("Loaded: %s\n",CkCert_subjectDN(cert));


    CkCert_Dispose(cert);

    }