Stream support ? (wodCrypt)
Hi,
We are using wodCrypt for an application of ours, and we have the following problem:
It seems that, in order to decrypt a file the component needs to load it all in memory first. And while the encryption/decryption is done correctly, this causes huge delays: a typical file is about 20-30MB, and a typical user has about 128-256 of memory. So loading all 30MB in memory causes extensive disk swapping.
Is there a way to implement your component withing a FileStream ?
Below is a code snippet, example of how we use wodCrypt (Delphi 7):
Function DecryptFile(Const Source,Destination: String): Integer;
Const
SKey = 'myProgKey';
LKey = 'myLicense';
Var
CryptObject: TWodCryptCom;
SourceBlob, DestinationBlob : TWodMemBlob;
SBlob, DBlob : IBlob;
Begin
Try
Try
CoInitialize(nil);
SourceBlob := WODCRYPTCOMLib_TLB.TwodMemBlob.Create(nil);
DestinationBlob := WODCRYPTCOMLib_TLB.TwodMemBlob.Create(nil);
SourceBlob.FromFile(Source);
SourceBlob.DefaultInterface.QueryInterface(WODCRYPTCOMLib_TLB.IID_IBlob, SBlob);
DestinationBlob.DefaultInterface.QueryInterface(WODCRYPTCOMLib_TLB.IID_IBlob, DBlob);
CryptObject := TwodCryptCom.Create(nil);
With CryptObject Do Begin
LicenseKey := LKey;
Optimized := False;
type_ := Blowfish;
SecretKey := SKey;
Decrypt(SBlob, DBlob);
End;
DestinationBlob.ToFile(Destination);
Finally
FreeAndNil(DestinationBlob);
FreeAndNil(SourceBlob);
FreeAndNil(CryptObject);
End;
Result := NO_ERROR;
Except
Result := ERROR;
End;
End;
Complete thread:
- Stream support ? - dandraka, 2005-11-07, 17:36
- Re: Stream support ? - wodSupport, 2005-11-07, 18:53
- Re: Stream support ? - mf, 2005-11-08, 09:53
- Re: Stream support ? - wodSupport, 2005-11-08, 13:48
- Re: Stream support ? - dandraka, 2005-11-09, 11:12
- Re: Stream support ? - wodSupport, 2005-11-09, 11:22
- Re: Stream support ? - dandraka, 2005-11-09, 11:25
- Re: Stream support ? - wodSupport, 2005-11-09, 11:26
- Re: Stream support ? - dandraka, 2005-11-09, 11:25
- Re: Stream support ? - wodSupport, 2005-11-09, 11:22
- Re: Stream support ? - dandraka, 2005-11-09, 11:12
- Re: Stream support ? - wodSupport, 2005-11-08, 13:48
- Re: Stream support ? - mf, 2005-11-08, 09:53
- Re: Stream support ? - wodSupport, 2005-11-07, 18:53