Sample code for 30+ languages & platforms
Objective-C

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat Objective-C Downloads

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

BOOL success = NO;

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

NSString *strPem = @"-----BEGIN CERTIFICATE----- ...";

success = [cert LoadPem: strPem];
if (success == NO) {
    NSLog(@"%@",cert.LastErrorText);
    return;
}

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

//  You can now use the public key object however it is needed,
//  and access its various properties and methods..

NSLog(@"%@",[pubKey GetXml]);