Sample code for 30+ languages & platforms
Delphi DLL

Example: Crypt2.SetEncodedIV method

Demonstrates how to call the SetEncodedIV method.

Chilkat Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Crypt2;

...

procedure TForm1.Button1Click(Sender: TObject);
var
crypt: HCkCrypt2;

begin
crypt := CkCrypt2_Create();

CkCrypt2_putCryptAlgorithm(crypt,'aes');
CkCrypt2_putCipherMode(crypt,'cbc');
CkCrypt2_putKeyLength(crypt,256);

// Note: The lenght of the IV is equal to the block size of the symmetric encryption algorithm.
// The block size for AES is 16 bytes.  Therefore, the IV is 16 bytes regardless of the encryption strenght (128-bit, 256-bit, etc.)
CkCrypt2_SetEncodedIV(crypt,'000102030405060708090A0B0C0D0E0F','hex');

// ...
// ...

CkCrypt2_Dispose(crypt);

end;