Sample code for 30+ languages & platforms
Objective-C

Example: Crypt2.SetSigningCert2 method

This example loads the certificate and private key from PEM files:

PEM Format

Certificate file (cert.pem or cert.crt):

-----BEGIN CERTIFICATE-----
MIID... (base64-encoded data)
-----END CERTIFICATE-----

Private key file (key.pem or key.key):

-----BEGIN PRIVATE KEY-----
MIIE... (base64-encoded data)
-----END PRIVATE KEY-----

Chilkat Objective-C Downloads

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

BOOL success = NO;

CkoCert *cert = [[CkoCert alloc] init];
success = [cert LoadFromFile: @"c:/certs_and_keys/certAbc.pem"];
// Assume success...

CkoPrivateKey *privKey = [[CkoPrivateKey alloc] init];
success = [privKey LoadAnyFormatFile: @"c:/certs_and_keys/certAbc_key.pem"];
// Assume success...

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

success = [crypt SetSigningCert2: cert key: privKey];
if (success == NO) {
    NSLog(@"%@",crypt.LastErrorText);
    return;
}

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