You are not logged in.
Pages: 1
What chaining mode does TAESWriteStream use?
Offline
So how to encrypt streams? By copying them to the array?
Offline
array of byte :-)
I need to encrypt stream (with chaining mode), how to do it best?
Like this?
procedure AESstreamCrypt(const aInStream, aOutStream: TStream; const aKey: TBytes; const aIV: TAESBlock);
var
lInput : TBytes;
lOutput : RawByteString;
begin
lAES := TAESCBC.Create(aKey[0], lKeySize);
try
lAES.IV := aIV;
aInStream.Position := 0;
// copy aInStream to TBytes local variable
SetLength(lInput, aInStream.Size);
aInStream.ReadBuffer(lInput[0], aInStream.Size);
//encypt TBytes
lOutput := lAES.EncryptPKCS7(lInput, False);
//copy encrypted data do output stream
aOutStream.Write(lOutput[1], Length(lOut));
finally
lAES.Free;
end;
end;
Offline
Pages: 1