OnDataDecrypt event/delegate/callback
Filter:
Pascal DLL C++ (DLL/Lib) C++ (VCL) C++ (.NET) C# VB.NETOverview
This event is fired when custom encryption is used and data block must be decrypted.
Declaration
[Pascal]
TSolFSCryptDataEvent = procedure(
Sender : TObject;
Key : Pointer;
KeyLength : LongWord;
Data : Pointer;
DataSize : LongWord;
ObjectID : LongWord;
PageIndex : LongWord;
var Result : LongInt) of object;
[DLL]
typedef Error (__stdcall *SolFSCryptDataFunc)(
LongWord UserData,
void * Key,
unsigned long KeyLength,
void * Data,
unsigned long DataSize,
unsigned long ObjectID,
unsigned long PageIndex);
[C++ (DLL/Lib)]
typedef Error (__stdcall *SolFSCryptDataFunc)(
LongWord UserData,
void * Key,
unsigned long KeyLength,
void * Data,
unsigned long DataSize,
unsigned long ObjectID,
unsigned long PageIndex);
[C++ (VCL)]
typedef void (__closure *TSolFSCryptDataEvent)(
System::TObject* Sender,
void * Key,
unsigned long KeyLength,
void * Data,
unsigned long DataSize,
unsigned long ObjectID,
unsigned long PageIndex,
unsigned long & Result);
[C++ (.NET)]
public __delegate void SolFSCryptDataEvent(
SolFSStorage* Sender,
unsigned char key __gc[],
unsigned char data __gc[],
unsigned long objectID,
unsigned long pageIndex,
Int32 __gc &result);
[C#]
public void SolFSCryptDataEvent(
SolFS.SolFSStorage Sender,
uchar[] Buffer,
uchar[] key,
uchar[] data,
unsigned long objectID,
unsigned long pageIndex,
ref int result);
[VB.NET]
Sub SolFSCryptDataEvent(
ByVal Sender As SolFS.SolFSStorage,
ByVal key As Byte(),
ByVal data As Byte(),
ByVal objectID As UInt32,
ByVal pageIndex As UInt32,
ByRef Result As Int32)
Parameters
- Sender - reference to the class that called the delegate/event handler
- Key - a key to be used in decryption
- KeyLength - length of the key
- Data - the data to be decrypted and a placeholder for decrypted data
- DataSize - the size of the data to be decrypted
- ObjectID - reference value that was passed during encryption of the data block
- PageIndex - reference value that was passed during encryption of the data block
- Result - out parameter (return value for DLL) where the application places the result of the operation. If you are working with file system, Win32 error code is a good candidate for placing to Result parameter. Otherwise you can use any other error codes, just be sure that 0 means success.
- [DLL] UserData - application-defined parameter which is specified when creating the storage and passed back to callback function.
Description
The event is fired when custom encryption is used and the data block must be decrypted. Data to decrypt is put to Data parameter. The size of the data is always multiple to 32.
The password specified for file or storage encryption is passed in Key parameter. When setting the password for the file or storage, you can use the key itself (and decrypt using this key) or specify the identifier of the decryption key. In the latter case this identifier is passed via Key parameter.
The event handler should put the result of decryption to the buffer pointed by Data parameter (i.e. the same buffer, which contains the encrypted data). This means that the size of the decrypted data block must not exceed the size of the encrypted data block.
See also
Information about callbacks (Driver Edition only) OnDataEncrypt
