Sample code for 30+ languages & platforms
Objective-C

Load PEM Format Certificate (.pem)

See more Certificates Examples

Loads a PEM format digital certificate and fetches information about the cert.

Chilkat Objective-C Downloads

Objective-C
#import <CkoCert.h>

BOOL success = NO;

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

// LoadFromFile will load virtually any certificate format file.
// It will auto-recognize the format and load appropiately.

success = [cert LoadFromFile: @"/Users/chilkat/testData/cer/cert.pem"];
if (success != YES) {
    NSLog(@"%@",cert.LastErrorText);
    return;
}

// DN = "Distinguished Name"
NSLog(@"%@%@",@"SubjectDN:",cert.SubjectDN);

NSLog(@"%@%@",@"Common Name:",cert.SubjectCN);
NSLog(@"%@%@",@"Issuer Common Name:",cert.IssuerCN);

NSLog(@"%@%@",@"Serial Number:",cert.SerialNumber);