Sample code for 30+ languages & platforms
Unicode C

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkHttpW.h>
#include <C_CkCertW.h>

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

    success = FALSE;

    http = CkHttpW_Create();
    cert = CkCertW_Create();

    success = CkHttpW_GetServerCert(http,L"chilkatsoft.com",443,cert);
    if (success == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkCertW_Dispose(cert);
        return;
    }

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

    //  Output:

    //  CN=*.chilkatsoft.com
    //  Wed, 10 Jun 2026 23:59:59 GMT


    CkHttpW_Dispose(http);
    CkCertW_Dispose(cert);

    }