Sample code for 30+ languages & platforms
Objective-C

Example: Crypt2.EncryptSb method

Demonstrates how to call the EncryptSb method.

Chilkat Objective-C Downloads

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

BOOL success = NO;

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

CkoBinData *bdEncrypted = [[CkoBinData alloc] init];
CkoStringBuilder *sbPlainText = [[CkoStringBuilder alloc] init];

[sbPlainText Append: @"Text to be encrypted"];

//  ...
//  Set the secret key ...
//  Set properties such as CryptAlgorithm, CipherMode, PaddingScheme, KeyLength
//  Set the IV if needed ...
//  ...

crypt.Charset = @"utf-8";

success = [crypt EncryptSb: sbPlainText bdOut: bdEncrypted];
if (success == NO) {
    NSLog(@"%@",crypt.LastErrorText);
    return;
}