(PHP ActiveX) Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.
<?php
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.Crypt2')
$crypt = new COM("Chilkat.Crypt2");
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.BinData')
$bdEncrypted = new COM("Chilkat.BinData");
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.StringBuilder')
$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;
}
?>
|