That is indeed an inputFormat issue. You can fix it this way:
procedure TDemoForm.AESDebugBtnClick(Sender: TObject);
var
Laes: TAESEncryption;
LCipher,LResultat: string;
Conv: TConvert;
begin
Laes:= TAESEncryption.Create;
Conv := TConvert.Create();
try
Laes.AType:= atCBC;
Laes.KeyLength:= kl256;
Laes.Unicode := yesUni;
Laes.Key:= '12345678901234567890123456789012'; // 'raw' key
Laes.inputFormat := raw;
Laes.OutputFormat := hexa;
Laes.PaddingMode:= TpaddingMode.PKCS7;
Laes.IVMode:= rand; // will be converted to hexa in the cryptogram
// Encrypt
LCipher:= Laes.Encrypt('my little test'); // raw string, unicode
MainMemo.Lines.Add('Cryptogram: ' + LCipher); // hex output
// Decrypt
// inputFormat is raw, convert Cryptogram that was in hex
Conv.AType := hexa;
LCipher := Conv.FormatToChar(LCipher);
// we want the output as a raw string (or whatever else)
Laes.OutputFormat := raw;
Laes.Decrypt( LCipher,LResultat);
MainMemo.Lines.Add('Cleartext: ' + LResultat);
finally
Conv.Free;
Laes.Free;
end;
end;