DecryptCallback function

Receives a block of data read from a FESF encrypted file for decryption.

Syntax

FE_DECRYPT_CALLBACK_FUNCTION DecryptCallback;

 

bool

DecryptCallback(

    _In_ void *CallbackContext,

    _In_ void *SolutionHeader,

    _In_ uint32_t SolutionHeaderSize,

    _In_ uint64_t FinalSize,

    _In_ void *EncryptedData,

    _In_ uint32_t EncryptedDataSize

   )

 

Parameters

CallbackContext [in]

A buffer containing context data provided to the Decrypt function.

SolutionHeader [in]

A buffer that contains the Solution Header retrieved by FESF from the encrypted file.

SolutionHeaderSize [in]

The size of the buffer pointed to by SolutionHeader, in bytes.

FinalSize [in]

The final size of the decrypted output for the file. Does not change across a single invocation of the Decrypt function that calls this callback.

EncryptedData [in]

A buffer containing the next block of encrypted data.

EncryptedDataSize [in]

The length of the data to be decrypted and written. Always provided as a multiple of CipherBlockSize, even if the decrypted contents may be of a different size. See Remarks.

Return value

Returns TRUE if the function successfully processes all the data, FALSE otherwise.

For Windows platforms, a specific status code for this function is reported with SetLastError().

For Linux platforms, the errno variable should be set to report a specific error code.

Remarks

This callback routine is called to provide encrypted data to an application to allow the application to produce a data stream that contains unencrypted data. 

FESF reads encrypted data blocks from the file and provides them sequentially to the application via this callback.  The callback decrypts the data provided.

The last block in a file may contain data padding as required by some encryption algorithms. Care should be taken to not write more data to the output stream than is specified by the FinalSize parameter.

If the encryption algorithm requires an Initialization Vector (IV), the application is required to use the same algorithm that FESF uses to generate a unique IV per cipher block.  For chained ciphers such as CBC, the encryption algorithm is likewise required to implement the same blocking scheme used by FESF.  See the section About the FESFSa Functions in this document for the description of these issues.

Examples

 

See Also

 

Requirements

Software version

FESF Version 1 (added)

Supported FESF State

FESF Not Installed ONLY

Windows Library

FesfSa.lib

Linux Library

FESFsa.a