NETProvider icon indicating copy to clipboard operation
NETProvider copied to clipboard

Make it possible to install callback function handler to pass DB encryption key to server.

Open AlexPeshkoff opened this issue 2 years ago • 0 comments

Currently the only way to pass dbcrypt key when attaching to database is provide it in connection string. Please provide 2 ways to use callback function that sends a key to the server in .net client:

  1. Let application install callback handler to process key requests from server in the application.
  2. If some library with fixed name (something like KeyCallback.dll, but certainly it's just an example) is available for dynamic load and some entrypoint (also KeyCallback for example) exists in it, that entrypoint is installed as such callback handler automatically.

Callback function should have 5 parameters: unsigned callback(void* context, unsigned dataLength, const BYTES* data, unsigned bufferLength, BYTES* buffer); where

  • context is a pointer to internal callback context (should be initialized with NULL before first call and not touched later),
  • dataLength and data are taken from packet sent by server,
  • bufferLength and buffer is a place to store data that should be returned to server. Function returns length of actual data placed into buffer (not more than bufferLength, looks like 16Kb should be enough). For each attach to database several callback calls may be performed.

AlexPeshkoff avatar Jan 27 '23 15:01 AlexPeshkoff