Perl
Chilkat2 Perl
Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $crypt = Chilkat2::Crypt2->new;
my $bdEncrypted = Chilkat2::BinData->new;
my $sbPlainText = Chilkat2::StringBuilder->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->Charset('utf-8');
my $success = $crypt->EncryptSb($sbPlainText, $bdEncrypted);
if (!$success) {
print $crypt->LastErrorText, "\n";
exit;
}