Sample code for 30+ languages & platforms
Objective-C

Transition from Crypt2.GetSignerCertChain to Crypt2.LastSignerCert

Provides instructions for replacing deprecated GetSignerCertChain method calls with LastSignerCert.

Chilkat Objective-C Downloads

Objective-C
#import <CkoCrypt2.h>
#import <CkoCertChain.h>
#import <CkoCert.h>

BOOL success = NO;

CkoCrypt2 *crypt2 = [[CkoCrypt2 alloc] init];

//  ...
//  ...
int index = 0;

//  ------------------------------------------------------------------------
//  The GetSignerCertChain method is deprecated:

CkoCertChain *certchainObj = [crypt2 GetSignerCertChain: [NSNumber numberWithInt: index]];
if (crypt2.LastMethodSuccess == NO) {
    NSLog(@"%@",crypt2.LastErrorText);
    return;
}

//  ...
//  ...

//  ------------------------------------------------------------------------
//  Do the equivalent using LastSignerCert, and then get the certificate chain from the cert.
//  Your application creates a new, empty Cert object which is passed 
//  in the last argument and filled upon success.

CkoCert *signerCert = [[CkoCert alloc] init];
success = [crypt2 LastSignerCert: [NSNumber numberWithInt: index] cert: signerCert];
if (success == NO) {
    NSLog(@"%@",crypt2.LastErrorText);
    return;
}

CkoCertChain *certChain = [[CkoCertChain alloc] init];
success = [signerCert BuildCertChain: certChain];
if (success == NO) {
    NSLog(@"%@",signerCert.LastErrorText);
    return;
}