Sample code for 30+ languages & platforms
Objective-C

Get Certificate Public Key from PEM

See more Certificates Examples

Demonstrates how to load a PEM file containing a certificate and access the public key.

Chilkat Objective-C Downloads

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

BOOL success = NO;

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

success = [cert LoadFromFile: @"qa_data/pem/my_cert.pem"];
if (success == NO) {
    NSLog(@"%@",cert.LastErrorText);
    return;
}

CkoPublicKey *pubkey = [[CkoPublicKey alloc] init];
[cert GetPublicKey: pubkey];

// Examine the public key as XML..
NSLog(@"%@",[pubkey GetXml]);