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 this works correctly.

procedure TForm1.Button1Click(Sender: TObject);
  source, encrypted,decrypted: string;
  idx: integer;
  iv: string;
  CodecTMS: TAESEncryption;
  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,