C
C
Example: Http.GetServerCert method
Demonstrates how to call the GetServerCert method.Chilkat C Downloads
#include <C_CkHttp.h>
#include <C_CkCert.h>
void ChilkatSample(void)
{
BOOL success;
HCkHttp http;
HCkCert cert;
success = FALSE;
http = CkHttp_Create();
cert = CkCert_Create();
success = CkHttp_GetServerCert(http,"chilkatsoft.com",443,cert);
if (success == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkCert_Dispose(cert);
return;
}
printf("%s\n",CkCert_subjectDN(cert));
printf("%s\n",CkCert_validToStr(cert));
// Output:
// CN=*.chilkatsoft.com
// Wed, 10 Jun 2026 23:59:59 GMT
CkHttp_Dispose(http);
CkCert_Dispose(cert);
}