OnDataEncrypt 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 encrypted.
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 encryption
- KeyLength - length of the key
- Data - the data to be encrypted and a placeholder for encrypted data
- DataSize - the size of the data to be encrypted
- ObjectID - reference value that can be used as additional salt during encryption
- PageIndex - reference value that can be used as additional salt during encryption
- 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 encrypted. The data to encrypt is passed in 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 encrypt using this key) or specify the identifier of the encryption key. In the latter case this identifier is passed via Key parameter.
The event handler should put the result of encryption to the buffer pointed by Data parameter (i.e. the same buffer, which contains the data to be encrypted). This means that the size of the encrypted data block must not exceed the size of the original data block.
ObjectID and PageIndex can be used as additional parameters to strengthen encryption.
See also
Information about callbacks (Driver Edition only) OnDataDecrypt
