PFNCryptStreamOutputCallback function pointer

The PFNCryptStreamOutputCallback function receives encrypted or decrypted data from tasks started by using the NCryptStreamOpenToProtect or NCryptStreamOpenToUnprotect functions. This callback must be defined by your application using the following syntax.

Syntax


typedef NTSTATUS ( CALLBACK *PFNCryptStreamOutputCallback)(
  _In_  void *pvCallbackCtxt,
  _In_  const BYTE *pbData,
  SIZE_T cbData,
  BOOL fFinal
);

Parameters

pvCallbackCtxt [in]

Pointer to data that you can use to keep track of your application. The data is not modified by the data protection API.

Note  You can set a pointer to your context data in the pvCallbackCtxt member of the NCRYPT_PROTECT_STREAM_INFO structure before passing a pointer to that structure in the pStreamInfo parameter of the NCryptStreamOpenToProtect or NCryptStreamOpenToUnprotect functions.

pbData [in]

Pointer to a block of processed data that can be used by the application.

cbData

The size, in bytes, of the processed data pointed to by the pbData parameter.

fFinal

If this value is TRUE, the current data block is the last to be processed and this is the last time the callback will be called.

Return value

If you return any status code other than ERROR_SUCCESS from your implementation of this callback function, the stream encryption or decryption process will fail.

Return codeDescription
ERROR_SUCCESS

The function was successful.

 

Remarks

Set a pointer to this callback function in the pfnStreamOutput member of the NCRYPT_PROTECT_STREAM_INFO structure. Set a pointer to the structure in the pStreamInfo parameter of the NCryptStreamOpenToProtect or NCryptStreamOpenToUnprotect functions.

You can use this callback to further process the encrypted or decrypted data. A common use of the function is to write the data to disk as it is received from the data protection API. The blocks of encrypted or unencrypted data are created by the NCryptStreamUpdate function.

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

NCryptprotect.h

See also

CNG DPAPI Functions
NCRYPT_PROTECT_STREAM_INFO
NCryptStreamOpenToProtect
NCryptStreamOpenToUnprotect
NCryptStreamUpdate

 

 

Community Additions

ADD
Show:
© 2014 Microsoft