Sample code for 30+ languages & platforms
Objective-C

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.

Chilkat Objective-C Downloads

Objective-C
#import <CkoHttp.h>
#import <CkoCert.h>

BOOL success = NO;

CkoHttp *http = [[CkoHttp alloc] init];
CkoCert *cert = [[CkoCert alloc] init];

success = [http GetServerCert: @"chilkatsoft.com" port: [NSNumber numberWithInt: 443] cert: cert];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

NSLog(@"%@",cert.SubjectDN);
NSLog(@"%@",cert.ValidToStr);

//  Output:

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