Sample code for 30+ languages & platforms
Objective-C

Duplicate openssl pkey -in private.pem -pubout -out pubkey.pem

See more OpenSSL Examples

How to output the public part of a private key: Demonstrates how to duplicate this OpenSSL command:
openssl pkey -in private.pem -pubout -out pubkey.pem

Chilkat Objective-C Downloads

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

BOOL success = NO;

CkoPrivateKey *pkey = [[CkoPrivateKey alloc] init];

// Load the private key from an PEM file:
success = [pkey LoadPemFile: @"private.pem"];
if (success == NO) {
    NSLog(@"%@",pkey.LastErrorText);
    return;
}

CkoPublicKey *pubKey = [[CkoPublicKey alloc] init];
[pkey ToPublicKey: pubKey];

success = [pubKey SavePemFile: NO path: @"pubKey.pem"];
if (success != YES) {
    NSLog(@"%@",pubKey.LastErrorText);

    return;
}

NSLog(@"%@",@"Success.");