Perl
Perl
Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.Chilkat Perl Downloads
use chilkat();
$success = 0;
$crypt = chilkat::CkCrypt2->new();
$bdEncrypted = chilkat::CkBinData->new();
$sbPlainText = chilkat::CkStringBuilder->new();
$sbPlainText->Append("Text to be encrypted");
# ...
# Set the secret key ...
# Set properties such as CryptAlgorithm, CipherMode, PaddingScheme, KeyLength
# Set the IV if needed ...
# ...
$crypt->put_Charset("utf-8");
$success = $crypt->EncryptSb($sbPlainText,$bdEncrypted);
if ($success == 0) {
print $crypt->lastErrorText() . "\r\n";
exit;
}