Sample code for 30+ languages & platforms
PHP ActiveX

Example: Crypt2.EncryptSb method

Demonstrates how to call the EncryptSb method.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

$crypt = new COM("Chilkat.Crypt2");

$bdEncrypted = new COM("Chilkat.BinData");
$sbPlainText = new COM("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 == 0) {
    print $crypt->LastErrorText . "\n";
    exit;
}


?>