Thank you, friend!
I still have trouble doing this.
I want to decrypt a file to memory, but no decrypted information can be saved in disk.
What I need to change in this code?
procedure TForm1.btnDecryptClick(Sender: TObject);
var
Cipher: TDCP_rc4;
KeyStr: string;
Source, Dest: TFileStream;
begin
KeyStr:= '';
if InputQuery('Passphrase','Enter passphrase',KeyStr) then // get the passphrase
begin
try
Source:= TFileStream.Create(boxInputFile.Text,fmOpenRead);
Dest:= TFileStream.Create(boxOutputFile.Text,fmCreate);
Cipher:= TDCP_rc4.Create(Self);
Cipher.InitStr(KeyStr,TDCP_sha1); // initialize the cipher with a hash of the passphrase
Cipher.DecryptStream(Source,Dest,Source.Size); // decrypt the contents of the file
Cipher.Burn;
Cipher.Free;
Dest.Free;
Source.Free;
MessageDlg('File decrypted',mtInformation,[mbOK],0);
except
MessageDlg('File IO error',mtError,[mbOK],0);
end;
end;
end;