(Delphi ActiveX) Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
...
procedure TForm1.Button1Click(Sender: TObject);
var
crypt: TChilkatCrypt2;
success: Integer;
bdEncrypted: TChilkatBinData;
sbPlainText: TChilkatStringBuilder;
begin
crypt := TChilkatCrypt2.Create(Self);
bdEncrypted := TChilkatBinData.Create(Self);
sbPlainText := TChilkatStringBuilder.Create(Self);
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.ControlInterface,bdEncrypted.ControlInterface);
if (success = 0) then
begin
Memo1.Lines.Add(crypt.LastErrorText);
Exit;
end;
end;
|