Sergey Suslo

AESEncryption Problem.

n this procedure with these AESEncryption properties, source and decrypted strings are not the same, and encrypted string is not dependent on encryption key. In version 2.5.0.0 this works correctly.

procedure TForm1.Button1Click(Sender: TObject);
var
  source, encrypted,decrypted: string;
  idx: integer;
  iv: string;
  CodecTMS: TAESEncryption;
begin
  iv:= '';
  for idx := 1 to 16 do
    iv := iv + Chr(0);
  
  CodecTMS.IV := iv;
  CodecTMS.IVMode := TIVMode.userdefined;
  CodecTMS.keyLength := TAESKeyLength.kl128;
  CodecTMS.key :='1234567890ABCDEF';
  CodecTMs.outputFormat := TConvertType.base64;
  CodecTMS.paddingMode := TPaddingMode.nopadding;
  CODECTMS.Unicode := TUnicode.noUni;
  Source := '1234567890ABCDEF';
  encrypted := COdecTMS.Encrypt(Source);
  decrypted := CodecTMS.Decrypt(encrypted);

Hi Sergey,
We identified this bug, due to StringToBufferA function in MiscObj. This will be solved in the 3.2 version, that will be released soon.
Best regards,
Marion