Sample code for 30+ languages & platforms
Objective-C

Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey

Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey.

Chilkat Objective-C Downloads

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

BOOL success = NO;

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

// ------------------------------------------------------------------------
// The ExportPrivateKey method is deprecated:

CkoPrivateKey *privatekeyObj = [cert ExportPrivateKey];
if (cert.LastMethodSuccess == NO) {
    NSLog(@"%@",cert.LastErrorText);
    return;
}

// ...
// ...

// ------------------------------------------------------------------------
// Do the equivalent using GetPrivateKey.
// Your application creates a new, empty PrivateKey object which is passed 
// in the last argument and filled upon success.

CkoPrivateKey *privatekeyOut = [[CkoPrivateKey alloc] init];
success = [cert GetPrivateKey: privatekeyOut];
if (success == NO) {
    NSLog(@"%@",cert.LastErrorText);
    return;
}