Sample code for 30+ languages & platforms
Objective-C

Example: Crypt2.LastSignerCert method

Demonstrates how to call the LastSignerCert method.

Chilkat Objective-C Downloads

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

BOOL success = NO;

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

NSString *p7m_path = @"qa_data/p7m/Firma.docx.p7m";
NSString *out_path = @"qa_output/Firma.docx";

success = [crypt VerifyP7M: p7m_path destPath: out_path];
if (success == NO) {
    NSLog(@"%@",crypt.LastErrorText);
    return;
}

// Examine the certificate(s) used for signing.
int numSigners = [crypt.NumSignerCerts intValue];
int i = 0;

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

while (i < numSigners) {
    [crypt LastSignerCert: [NSNumber numberWithInt: i] cert: cert];
    NSLog(@"%@%@",@"Signer: ",cert.SubjectDN);
    i = i + 1;
}