Sample code for 30+ languages & platforms
C++

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.

Chilkat C++ Downloads

C++
#include <CkHttp.h>
#include <CkCert.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkHttp http;
    CkCert cert;

    success = http.GetServerCert("chilkatsoft.com",443,cert);
    if (success == false) {
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }

    std::cout << cert.subjectDN() << "\r\n";
    std::cout << cert.validToStr() << "\r\n";

    //  Output:

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