TAESEncryption Decrypt string is blank?

Using Delphi 10.2.3
Win32 Compiling

Latest Crypto Pack as of today. 4.3.1.0

AESEncryption.DecryptFileW seems to work with what I have.

AESEncryption.Decrypt to do same data via A string, returns a blank string. No error.

I made a small routine to do this and this works, using the DecryptStream and TStringStreams....

function DecryptString(s: string; aes: TAESEncryption): string;
var
  stream1, stream2: TStringStream;
begin
  stream1 := TStringStream.Create;
  stream1.Position := 0;
  stream1.WriteString(s);
  stream2 := TStringStream.Create;
  aes.DecryptStream(stream1, TStream(stream2));
  Result := stream2.DataString;
  stream1.Free;
  stream2.Free;
end;
....
var 
  eStr : String;
  dStr : String;
...
    
  AESEncryption := TAESEncryption.Create(nil);
  AESEncryption.AType := atCBC;
  AESEncryption.IVMode := userdefined;
  AESEncryption.keyLength := kl256;
  AESEncryption.IV := HexToString(strIVHex);
  AESEncryption.key := HexToString(strKeyHex);
  AESEncryption.Unicode := TUnicode.noUni;
  AESEncryption.paddingMode := PKCS7; 
  AESEncryption.outputFormat := raw;
  eStr := tfile.ReadAllText(inputFIle, tencoding.ANSI);
  dStr := DecryptString(eStr, AESEncryption); // <-- my flavor using string streams
  // dStr := AESEncryption.Decrypt(eStr); // <---- this won't work. dSTR is blank. reported to TMS.
  Memo2.text := dStr;
  AESEncryption.Free;

I will eventually not get a file, but a dump of the AES-256-CBC data from a stored procedure call.
And need to decrypt it on the fly.

My DecryptString call works, but wondering if this is a bug or am I missing something?

Hi Steve,
You should use either
EncryptFileW / DecryptFileW
or EncryptStream / DecryptStream
for files/streams.
bernard

from my original post

So when the stored proc is done, from system I have to talk to, they will be giving me the same exact data that was in the file.

So my initial tests right now is file, I tried making a version to work via String usage. As ill be getting the same data as a string that was inside my "test" file.

So in my tests above, I wanted the contents of the file, inside a string var, to then decrypt that string var. ala, simulate how I'll be getting it and storing it eventually soon.