TCipher.GetInstance

Creates new TCipher instance


Syntax

class function TCipher.GetInstance(AAlgID: TAlgID): TCipher; static;

Parameters

Returns

Remarks

Examples

Encrypt file using built-in engine, AES algorithm, CBC mode of operation, PKCS padding

uses
  tfArrays, tfCiphers;

procedure EncryptCBC(const FileName: string; const Key, IV: ByteArray);
var
  Cipher: TCipher;

begin
  Cipher:= TCipher.GetInstance(AES_CBC_ENCRYPT);
  try
    Cipher.Init(Key, IV)
          .EncryptFile(FileName, FileName + '.aes');
  finally
    Cipher.Burn;
  end;
end;