Sample code for 30+ languages & platforms
Objective-C

Example: Crypt2.ClearSigningCerts method

Demonstrates how to call the ClearSigningCerts method.

Chilkat Objective-C Downloads

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

BOOL success = NO;

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

// Tell the crypt object to use 3 certificates.
// Do this by calling AddSigningCert for each certificate.

CkoCert *cert1 = [[CkoCert alloc] init];
// ...
// Load the cert from a source such as a .pfx/.p12 file, smart card, USB token, Apple keychain, Windows certificate store, etc.
// ...
[crypt AddSigningCert: cert1];

CkoCert *cert2 = [[CkoCert alloc] init];
// ...
[crypt AddSigningCert: cert2];

CkoCert *cert3 = [[CkoCert alloc] init];
// ...
[crypt AddSigningCert: cert3];

CkoBinData *bd = [[CkoBinData alloc] init];
// ...

success = [crypt OpaqueSignBd: bd];

// Let's say we now want to sign something else with different certs..
// First clear the signing certs.
[crypt ClearSigningCerts];

CkoCert *cert4 = [[CkoCert alloc] init];
// ...
[crypt AddSigningCert: cert4];

CkoCert *cert5 = [[CkoCert alloc] init];
// ...
[crypt AddSigningCert: cert5];

// ...
// ...

// Sign using cert4 and cert5.
success = [crypt OpaqueSignBd: bd];