Sample code for 30+ languages & platforms
C#

Example: Crypt2.EncryptSb method

Demonstrates how to call the EncryptSb method.

Chilkat C# Downloads

C#
bool success = false;

Chilkat.Crypt2 crypt = new Chilkat.Crypt2();

Chilkat.BinData bdEncrypted = new Chilkat.BinData();
Chilkat.StringBuilder sbPlainText = new Chilkat.StringBuilder();

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,bdEncrypted);
if (success == false) {
    Debug.WriteLine(crypt.LastErrorText);
    return;
}